Free Support Forum - aspose.com

Problems Creating PNG Images of PDF Pages Using Aspose.Pdf.Net Evaluation

Hello,

Using latest evaluation version of Aspose.Pdf for .Net I am trying to create a png image of each page in a pdf using the example taken from the pdf documentation. Basically, I open the pdf, loop through each page creating a 300dpi png and saving them via a filestream to disk.

The process only works on the first 4 pages, then the images are all blank zero byte files for pages 5 onward.

Is this a bug or is it an intentional limitation within the evaluation version?

Also I am using evaluation version of Aspose.Words to first convert a docx to a pdf and then use Aspose.pdf to output the images. By introducing Aspose.Words into the above situation it causes the png creatino0 process to fail after page 2. Is this problem related to the above issue?

NigelP:

Using latest evaluation version of Aspose.Pdf for .Net I am trying to create a png image of each page in a pdf using the example taken from the pdf documentation. Basically, I open the pdf, loop through each page creating a 300dpi png and saving them via a filestream to disk.

The process only works on the first 4 pages, then the images are all blank zero byte files for pages 5 onward.

Is this a bug or is it an intentional limitation within the evaluation version?

Hi Nigel,

Thanks for using our products. When using the product in evaluation mode, only first four pages can be manipulated. However you may request a 30 days temporary license to test the product without any limitation. Please visit the following link for more information on Get a temporary license

NigelP:
Also I am using evaluation version of Aspose.Words to first convert a docx to a pdf and then use Aspose.pdf to output the images. By introducing Aspose.Words into the above situation it causes the png creatino0 process to fail after page 2. Is this problem related to the above issue?
Please note that you can also use Aspose.Words to directly render the pages of word document in to image format. So when calling Document.Save(…) method, specify image file type from SaveFormat enumeration instead of Pdf. Please take a look over following code lines.

[C#]

Aspose.Words.Document
doc = new Aspose.Words.Document(“source.doc”);<o:p></o:p>

doc.Save(“outputimage.jpeg”,
Aspose.Words.SaveFormat.Jpeg);


You may also consider sharing the resultant PDF file which you are using for conversion to Image format so that we can test the scenario at our end. We are sorry for this inconvenience.

Thanks for the prompt reply.

I have downloaded 30 days license for both products. This now resolves the 4 page limitation, but it does not resolve the problem we are experiencing with the code below. Here we use Aspose.Word to convert the attached single page word document (page.docx) to a pdf file (page.pdf), then we use Aspose.Pdf to open the page.pdf and convert all the pages to png images. When we run this we find that the resulting Page1.png is a zero byte file. Can you recreate this problem? Further information: If we use Word 2007 to save page.docx as page.pdf, we find that Aspose.Pdf correctly creates the png image.

Aspose.Words.Document doc = new Aspose.Words.Document("c:\\page.docx");

doc.Save("c:\\page.pdf", Aspose.Words.SaveFormat.Pdf);

Aspose.Pdf.Document pdf = new Aspose.Pdf.Document("c:\\page.pdf");

for (int pageCount = 1; pageCount <= pdf.Pages.Count; pageCount++)

{

using (FileStream imageStream = new FileStream ("c:\\page" + pageCount + ".png", FileMode.Create))

{

Resolution res = new Resolution(300);

PngDevice dev = new PngDevice(res);

dev.Process(pdf.Pages[pageCount], imageStream);

imageStream.Close();

}

}

Hi Nigel,


Thanks for sharing the details.

I have tested the scenario using Aspose.Words for .NET 11.11.0 and Aspose.Pdf for .NET 7.6.0 and as per my observations, the word document is properly being converted to PDF format and then PDF file is being rendered in PNG image, without any issue. Can you please try using the latest release versions and in case you still encounter the same issue or you have any further query, please feel free to contact. We are sorry for your inconvenience.

Hi, Many thanks. The latest version of Aspose.Word fixes the problem. It looks like I didn’t have the latest version which I downloaded from ComponentSource. You may want to ask them to stock the latest evaluations of your products on their system. Thanks again.

Hi Nigel,


Thanks for sharing the information. I am glad to hear that your problem is resolved. I would recommend you to always get the the latest copy of our product releases from download module over file server.

Nevertheless, we will get in touch with ComponentSource and will ask them to keep the latest copy of our products. Furthermore, you may also get the latest copy of product releases as Nuget packages.