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

Free Support Forum - aspose.com

Trouble generating thumbnail from specific PDFs

Hello!


Currently we’re facing some problems in our application when we try to generate a thumbnail from some specific PDF files.
We’re currently have Aspose 7.1.0.0 version and when we got this problem we decided to test the newer version (17.3.0.0) to see if the problem was solved.

It’s important that not all files are giving us problem, just some files that we’re not being able to generate a PNG image to use as thumbnail.

I downloaded the newest version available but the problem persisted.
With that in mind, we’d like to know if there’s a way to make this work with the newest version so we can update our version, which at the moment is not an option since the problem still happens in the newest version available.

I attached the file that the causes the problem (we can reproduce the error with all files that are the same type that I’m attaching)

Also, here’s the code that we’re using to convert the PDF to a PNG image:

-------------------------------------------

String documentPath = “~mypath\documentoTesteThumbnail.pdf”;
String thumbnailPath = “~mypath\doc_thumbnail.png”;

Document pdfDocument = new Document(documentPath);

using (FileStream imageStream = new FileStream(thumbnailPath, FileMode.Create))
{
//create Resolution object
Resolution resolution = new Resolution(150);
//create PNG device with specified attributes (Width, Height, Resolution)
PngDevice pngDevice = new PngDevice(110, 160, resolution);

//convert a particular page and save the image to stream
pngDevice.Process(pdfDocument.Pages[1], imageStream);
//close stream
imageStream.Close();
}

If there’s anything else that I can provide to help to identify this case or I wasn’t clear enough, please let me know.
At,

Hi Alexandre,


Thanks for contacting support.

I have tested the complete scenario with the latest version of Aspose.Pdf for .NET which is 17.4.0. I have used the same code snippet which you have shared and I was unable to notice any issue. The thumbnail has been generated successfully at my side. I also have attached the generated output for your reference. Please note that it is always recommended to use the latest version of the API. Please try using Aspose.Pdf for .NET 17.4.0 to achieve the functionality and in case if you still face any issue, please feel free to let us know.


Best Regards,