I have a requirement for converting TIFF to PDF. The code that I am using converts tiff to PDF but however the PDF image is not similar to the tiff image as some of the area is cut in the PDF image and the size is bigger than TIFF. below is the code that I am using.. Please can anyone suggest the better way for converting tiff to PDF.. Thanks in advance
How big (in terms of pixels and DPI) is the TIFF? Would it fit onto a US Letter page? And what do you mean by "the size is bigger than TIFF"?
Madhu Sudhan B T
Joined: Nov 18, 2009
Thanks for the reply.. I am attaching the file that I am trying to convert. When I open the converted PDF file, the zoom % is always 141% and I need that to be 100 % and some of the text is cut in the converted PDF image.
I am using the attached file just for testing but I am looking for generic code to convert all tiff files to PDF.
Please let me know if you need more info.. Thanks for your help..
Joined: Mar 22, 2005
I have removed the image as it seems to contain actual bank account data. You should never post such data publicly; and you are most likely prohibited from doing so by nondisclosure agreements with your employer.
It looks to me like the PDF is correct - the image is at the bottom of the page (you put it at (0,0), which is the lower left), and it is wider than US Letter, so the right part is cut off.
Try replacing lines 54 and 56 with something like img.scalePercent(50.0f, 50.0f) (which scales the image down by 50%). You can find out how tall and how wide US Letter is in pixels from the PageSize.LETTER rectangle - that should be useful when figuring out the best scale percentage.
The code doesn't compile against the latest version of iText 2, by the way - if you don't have iText 2.1.7 you may wish to upgrade to that.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com