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

Free Support Forum - aspose.com

Generate JPEG from multi page PDF

Hello,


A simple question …

I want to convert a multi pages PDF’s file (by the way orignal format is RTF) to JPEG. A this point Aspose can only generate the first page of this doc.

Have you got any solution for me ?

Best regards,


Hi,


Thanks for your inquiry. Please note that you can not load PDF documents directly into Aspose.Words Document instance. However, please try using the following code to be able to generate JPEG files for your original RTF document:

Document document = new Document(@“C:\test\In.rtf”);<o:p></o:p>

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Jpeg);

options.PageCount = 1;

// Save each page of the document as Jpeg.

for (int i = 0; i < document.PageCount; i++)

{

options.PageIndex = i;

document.Save(string.Format(@"C:\test\out_{0}.jpg", i), options);

}


I hope, this will help.

Best Regards,

OMG !


You’re faster than lightning !

It works absolutly fine !

I put a correct version of the script :

Document document = new Document(file);
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
options.setPageCount(1);
// Save each page of the document as Jpeg.
for (int i = 0; i < document.getPageCount(); i++){
options.setPageIndex(i);
document.save( new String(file + i + “.jpg”).toString(), options.getSaveFormat());
}

And I close the ticket.

Thanks a lot.

Best regards,


ooops,


I’ve a little prob.

My script does only convert the first page.

It surly comes from my adaptation of your script. But where ?

Is your script writen in Java ?


Hi,


Thanks for your request. Please see the following correction:

document.save(new String(file +
i + “.jpg”).toString(), options.getSaveFormat());<o:p></o:p>


Best Regards,

Perfect !


Thanks a lot !

Best regards