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

Free Support Forum - aspose.com

Aspose Multi Tiff to Pdf Conversion Issue

We are using Aspose Total for quite some time for multiple file type conversion and recently we are facing an issue while we tried to convert a multi-page tiff to PDF via java APIs, we are getting blank pages post-conversion.
Below is the code template used for conversion.


Would you please share your sample TIFF file for our reference? Also, please share which version of the API are you using? We will test the scenario in our environment and address it accordingly.


Attached is the input and output samples.
OutPut Pdf.zip (497.9 KB)


Since, you are using Aspose.Total Package, would you please try using the below code snippet that we used to test the case and let us know if you face any issues:

public void TiffToPdf()
        try {
            com.aspose.imaging.fileformats.tiff.TiffImage image = (com.aspose.imaging.fileformats.tiff.TiffImage)com.aspose.imaging.Image.load(new ByteArrayInputStream(FileUtils.readFileToByteArray(new File(dataDir + "InPut Tiff.tiff"))));
            Document document = new Document();
            for (com.aspose.imaging.fileformats.tiff.TiffFrame frame : image.getFrames()) {
                com.aspose.pdf.Image pdfImage = frameToImage(frame);
                addImageToPage(document, pdfImage, frame.getWidth(), frame.getHeight(), frame.getHorizontalResolution(), frame.getVerticalResolution());
            document.save(dataDir + "output.pdf");
        }catch (Exception ex){

    private com.aspose.pdf.Image frameToImage(com.aspose.imaging.fileformats.tiff.TiffFrame frame) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        com.aspose.imaging.imageoptions.TiffOptions options = new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.TiffNoCompressionRgb);
        frame.save(stream, options);

        com.aspose.pdf.Image image = new com.aspose.pdf.Image();
        image.setImageStream(new ByteArrayInputStream(stream.toByteArray()));
        return image;

    private Page addImageToPage(Document document, com.aspose.pdf.Image image, int width, int height, double horizontalResolution, double verticalResolution) {
        Page page = document.getPages().add();
        width = (int) (width * (72.0 / horizontalResolution));
        height = (int) (height * (72.0 / verticalResolution));

        page.getPageInfo().setMargin(new MarginInfo(0,0,0,0));

        return page;