Hellow,
I am beginner in ASP.Net and am working with Laserfiche SDK, But when trying to access the LFDocument Object I get the following Error.
Unable to cast COM object of type 'System.__ComObject' to interface type 'LFSO80Lib.LFDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{E1828B6A-D73E-4AD8-A3E1-EE3CA060D194}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
event viewer does not show anything regarding this error. If I dont use that Object everything works fine but I need to get the documents so I must use that.
here is my sample code
using System;
using System.Configuration;
using System.Data;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using LFSO80Lib;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lbtest.Text = "";
LFSO80Lib.LFApplication app = new LFSO80Lib.LFApplication();
LFSO80Lib.LFServer serv = (LFSO80Lib.LFServer)app.GetServerByName("host NAME");
LFSO80Lib.LFDatabase db = (LFSO80Lib.LFDatabase)serv.GetDatabaseByName("REPOSITORY NAME");
LFSO80Lib.LFConnection conn = new LFSO80Lib.LFConnection();
conn.UserName = "USERNAME";
conn.Password = "PASSWORD";
conn.Create(db);
int id = Int32.Parse(Request.QueryString["ID"]);
LFDocument doc = (LFDocument)db.GetEntryByID(id);
LFSO80Lib.LFDocumentPages docpages = (LFSO80Lib.LFDocumentPages)doc.Pages;
docpages.MarkPageByIndex(1);
DocumentProcessor80.DocumentExporter exporter = new DocumentProcessor80.DocumentExporter();
exporter.AddSourcePages(docpages);
exporter.Format = DocumentProcessor80.Document_Format.DOCUMENT_FORMAT_PNG;
byte[] imageStream = null;
imageStream = (byte[])exporter.Export();
doc.Dispose();
conn.Terminate();
Response.ContentType = "image/jpeg";
Response.BinaryWrite(imageStream);
Response.End();
}
}
Any help please..