Free Support Forum - aspose.com

Can I set the compression method when converting PDF to TIFF?


Aspose.Pdf.Kit saved us a lot of work with converting PDFs into TIFF files for one client who still wants documents in that format.

My problem is that for some PDFs we get, they get converted to gigantic TIFF file sizes. A two megabyte PDF expanded to a 32 meg TIFF file today. I’m wondering if there’s any strategies to manage the TIFF output size. I’m noticing the TIFF compression is set to 32773, or ‘PackBits’. I’m wondering if there’s an option to try another compression method, such as ‘5’, or ‘LZW’.

The source image itself is just large, a 33 page PDF of text, maybe some half-tone on some pages but clean, as the PDF was a converted document rather than scanned.

Any hints to reduce the TIFF file size after being converted from PDF?

Thanks!

-Derrick

Hi Derrick,

I’m sorry to share with you that currently Aspose.Pdf.Kit for Java doesn’t allow setting compression while converting PDF to TIFF images. However, if you could share which particular compression type you’re interested in, we’ll be able to log a new feature request and provide support in our future versions. Nevertheless, this might take some time before the new feature is supported.

We’re sorry for the inconvenience.
Regards,

Shahzad-

No worries, I actually lucked out and the TIFF compression issue was rendered moot. What we eventually found out was that the client was converting the TIFFs back to PDFs, so a few phone calls and the issue was resolved - we just transmit a PDF and bypass the whole PDF->TIFF->PDF process that was causing us so much pain.

However, if you’re still interested in implementing compression strategies on TIFF, one thing that you probably would like to know is that all our TIFFs came from eFax (the company that does our fax service), which is encoded in CCITT T.6 compression. I honestly don’t know if this compression is superior to any of the other ones, but it would be very useful to have this compression level handy if the intention was to transmit/receive a TIFF as a fax image.

However we’ve solved our problem so it’s of academic interest, but I think someone, somewhere is eventually going to run into the same problem we did, doing a PDF->TIFF conversion which results in a monstrous TIFF file size. No idea why Aspose does that for some files but not others, but making different compression strategies available would be a useful tool.

Thanks!

-Derrick

Hi Derrick,

We already support different compression types when converting PDF to TIFF in our .NET version; however, we’re currently working on supporting these compressions for our Java version as well. The CCITT compression is logged as PDFKITJAVA-11418 in our issue tracking system. You’ll be notified via this forum thread once it is supported, so you could use it if needed in your future projects. Nevertheless, I’m glad to know that the issue is resolved at your end.

If you find any further questions, please do let us know.
Regards,

Hi Derrick,

I have received the sample input file. If the other files have the same origin and similar contents then you don’t need to send multiple files, as the structure would be similar and probably the cause of the issue would be same as well. Moreover, if you could share the particular code snippet which you’re using at your end, we’ll be able to test the issue at our end using your particular scenario.

I have tested this issue and received the blank output TIFF image. I also received an exception. Are you getting some exception as well during the conversion process? Please share your thoughts, so we could guide you accordingly.

We’re sorry for the inconvenience.
Regards,


Hi Shahzad-

Thanks for looking into it - the blank faxes only happen occasionally. My code is pretty straightforward:

String tiff="/somedirectory/filetosend.tif";

PdfConverter converter = new PdfConverter();

converter.bindPdf(“source.pdf”);
converter.doConvert();
converter.saveAsTIFF(tiff);

I tried it with the problem PDFs and couldn’t induce an exception, the only way to tell is to open the output and see if it’s blank.

Thanks again!

-Derrick

Hi Derrick,

Thank you very much for sharing further details. I have logged this issue as PDFKITJAVA-31564 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,