Free Support Forum - aspose.com

Problems converting TIFF to PDF

I’m trying to convert a TIFF image to PDF using setImageStream. The result does not correspond to the original imgage showng some strange pattern.

Here is the source code:

        Document doc = new Document();
        Page page = doc.getPages().add();
        page.getPageInfo().getMargin().setBottom(0);
        page.getPageInfo().getMargin().setTop(0);
        page.getPageInfo().getMargin().setLeft(0);
        page.getPageInfo().getMargin().setRight(0);
        page.getPageInfo().setWidth(w);
        page.getPageInfo().setHeight(h);

        Image image1 = new Image();
        page.getParagraphs().add(image1);
        java.io.FileInputStream fs = new java.io.FileInputStream(in);
        image1.setImageStream(fs);
        fs.close();

        doc.save(out.toString());
        doc.close();

The problematic tiff file can be downloaded from this link: https://v16-test.triboni.cloud/test/img.tif

The result can be downloaded from here: https://v16-test.triboni.cloud/test/img.pdf

Other files work.

@martin.duerig

Thanks for contacting support.

We were able to replicate the issue in our environment using latest version of the API. Hence, logged it as PDFJAVA-37884 in our issue tracking system. We will further investigate the issue in details and keep you informed with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

Im having some problem as well. the size of the tiff image is reduced in the pdf a lot … looks like the pdf has some margins and it is very small compared with the Original image

@comaschi

The issue was about the wrong color pattern of TIFF image inside output PDF and it has been resolved in latest version of the API. Would you kindly share your sample TIFF image with complete code snippet that you are using. We will test the scenario in our environment and address it accordingly.