Multipaged TIFF To PDF

I am trying to convert a multipaged TIFF to a PDF using the aspose-imaging-1.8-jdk15 and aspose-pdf-4.2.0 (com.aspose.pdf package) and have encountered an issue in trying to extract individual TIFF frames.

My approach is to create an empty PDF document, iterate over the collection of TIFF frames and for each frame add a new page to the PDF and then add the frame image to the page. I have most of it working but get an error trying to access the TiffFrame.save() method.

ByteArrayOutputStream tiffFrameOutputStream = new ByteArrayOutputStream();
tiffFrame.save(tiffFrameOutputStream);
The error is "The method save(M) in the type TiffFrame is not applicable for the arguments (ByteArraryOutputStream)

I'm confused as to what "M" means. There doesn't seem to be any javadoc intellisense for the methods that have this type. Could I be missing a .jar in my classpath?

Is there a better approach to converting a multipaged TIFF to PDF?

Please see the attached screenshots.

Hi Scot,


Thank you for considering Aspose products.

I would like to address your main concern first, that is, Convert the multi-paged Tiff image to a PDF. Please note, your requirement can be achieved using the Aspose.Pdf for Java product alone. Below provided is a link from our online documentation that elaborates the usage of Aspose.Pdf for Java component to extract the frames from a Tiff file, and to inject them in a newly created Pdf file.
http://www.aspose.com/docs/display/pdfjava/Convert+TIFF+frames+to+JPEG+compression+and+transform+to+PDF

Your second concern is about the misleading/confusing intellisense comments regarding the TiffFrame.save method. I have checked the issue on my end, and found it to be true. Moreover, I have also tried by attaching the Javadoc to my eclipse project (please see attached snapshot) but in vain. Therefore I have logged this problem in our bug tracking system under the ticket IMAGING-33721 for investigation purposes. As soon as we hear anything from the development team in this regard, we will notify you here. In the meanwhile, please use the offline documentation provided to you in the installer archive for your kind reference.

Please accept our apologies for the inconvenience caused.

I noticed under the Aspose.PDF for Java's Programmer's Guide that aspose.pdf was flagged as being legacy. The example link provided above is using the Aspose.Pdf package as apposed to the newer com.aspose.pdf. Is there an online example for converting multi-paged TIFFs to PDF using the com.aspose.pdf package?

Hi Scot,


Thanks for your inquiry. Iā€™m afraid currently Image to PDF conversion is not available in Aspose.Pdf for Java DOM approach. i.e. com.aspose.pdf package. We have logged a feature request for same as PDFNEWJAVA-33738 in our issue tracking system. We will update you as soon as its implemented.

Moreover, as a workaround you can use above suggested example for converting multi-page TIFF to PDF.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as IMAGING-33721) have been fixed in this update.


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

Hi Scot,

Thanks for your patience. In reference to PDFNEWJAVA-33738, please download latest version of Aspose.PDF for Java 9.7.0 and use following code snippet for converting multi-page TIFF to PDF. It will help you to accomplish the task.

Document pdf = new Document();

// Create a section in the Pdf object
Page sec = pdf.getPages().add();

// Create an image object in the section
com.aspose.pdf.Image img = new com.aspose.pdf.Image();

// Add image object into the Paragraphs collection of the section
sec.getParagraphs().add(img);

// Set the path of image file
img.setFile(*myDir * +"test.tiff");
img.setInNewPage(true);

// Save the Pdf
pdf.save(*myDir * +"TIFFConversion_image_toPDF_971.pdf");

Please feel free to contact us for any further assistance.

Best Regards,

1 Like

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.