We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Adobe Reader X documents renders incorrect preview image

I’m generating a preview image of a PDF using PngDevice. Adobe Reader X documents are not showing the preview correctly. It just renders a view saying Reader X is required.


I’ve attached the sample PDF and the image output.

I’m using the following code to generate the image:
            MemoryStream stream = new MemoryStream();
Document pdfDocument = new Document(sourceFileInfo.FullFilePath);
        <span style="color: rgb(43, 145, 175); ">Page</span> firstPage = pdfDocument.Pages.Cast<<span style="color: rgb(43, 145, 175); ">Page</span>>().First();
        <span style="color: rgb(43, 145, 175); ">PngDevice</span> pngDevice = <span style="color: blue; ">new</span> <span style="color: rgb(43, 145, 175); ">PngDevice</span>((<span style="color: blue; ">int</span>)firstPage.MediaBox.Width, (<span style="color: blue; ">int</span>)firstPage.MediaBox.Height);

        pngDevice.Process(firstPage, stream);</pre><pre style="font-family: Consolas; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><br></pre><pre style="font-family: Consolas; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; "><br></pre></div>

Hello
Muppets,


Thanks for using our products.

I have tested the scenario and I am able to notice the same problem when trying to convert PDF Portfolio into Image format. We will further look into the details of this problem and will keep you updated on the status of correction. We are really sorry for this inconvenience.

Hello Muppets,


Can you please share some details regarding your requirement for converting portfolio PDF into Image format. In fact the portfolio is a collection of many documents, and such type of PDF documents always have one page with standard contents which you have already got with your code snippet. However if you want to get images of pages from individual PDF files in portfolio, you need to work with that document directly. Any ways, before I comment further, please share the details regarding your requirement.

Hi,


The most ideal thing would be to get a thumbnail of the first page of each document stored in the collection.

Is it possible to access the documents stored in the collection with ASPOSE?

Thanks

Neil

Hello Neil,


Thanks for sharing the details.

We are working on your requirement to get individual documents from document collection and then convert each of them into Image format. Soon you will be updated with the status of correction.

The issues you have found earlier (filed as PDFNEWNET-33310) have been fixed in Aspose.Pdf for .NET 9.3.0.

Blog post for this release can be viewed over this link


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Neil,


Thanks for your patience. As stated above your reported issue has been resolved. Please check following code snippet for the purpose. Hopefully it will help you to accomplish the task.

Document portfolio = new Document(“input.pdf”);<o:p></o:p>

for (int i = 1; i <= portfolio.Collection.Count; i++)

{

FileSpecification fs = portfolio.Collection[i];

if (fs.MIMEType != "application/pdf")

continue;

PdfConverter converter = new PdfConverter();

converter.BindPdf(fs.Contents);

converter.StartPage = 1;

converter.EndPage = 1;

converter.DoConvert();

if (converter.HasNextImage())

{ converter.GetNextImage(fs.Name + ".jpg", ImageFormat.Jpeg); }

}

Please feel free to contact us for any further assistance.


Best Regards,