Free Support Forum - aspose.com

Issue loading Pdf document

Hello,

I am evaluating your PDF product. I am not getting an error loading the document from the stream, but the document does not contain any pages (page count =0 and should be 110. I have attached the file that is being read in. The following is the code I am using to attempt this load. I have validated that the memory stream is valid. I am running vs2005. using your 2.0 components of Apose.Pdf and Apose.Pdf.kit version 5.

Thanks Jeff

public virtual void LoadDocument(string fileName)
{
if (FileUtilities.FileExists(fileName))
{
LoadDocument(File.ReadAllBytes(fileName));
}
else
{
throw new FileNotFoundException();
}
}
public override void LoadDocument(Stream stream)
{
_document = new Pdf();
_stream = stream;
_stream.Position = 0;
_document = new Pdf(_stream);
_stream.Position = 0;
_editor = new PdfViewer();
_editor.OpenPdfFile(_stream);
}

public override void LoadDocument(byte[] bytes)
{
MemoryStream stream = new MemoryStream(bytes);
LoadDocument(stream);
}

Hi Jeff,

I would like to share with you that Aspose.Pdf only allows you to create PDF files from scratch; it doesn’t allow you to load an existing PDF file. If you want to load an existing PDF file then you’ll have to use Aspose.Pdf.Kit. I have tried to load the PDF using PdfViewer class of Aspose.Pdf.Kit and it worked fine at my end.

Could you please use the latest version of Aspose.Pdf.Kit for .NET and try to load the PDF file? Also, if you find any further questions, please do let us know, so we could guide you accordingly.

Regards,

Sorry, about that. Yes using pdf kit provided the functionality I was looking for.

Thanks. You can consider this issue closed.

Jeff