This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Converting TIFF to PDF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Converting TIFF to PDF" Watch "Converting TIFF to PDF" New topic
Author

Converting TIFF to PDF

Madhu Sudhan B T
Greenhorn

Joined: Nov 18, 2009
Posts: 21
Hi All,

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

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39575
    
  27
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"?


Ping & DNS - updated with new look and Ping home screen widget
Madhu Sudhan B T
Greenhorn

Joined: Nov 18, 2009
Posts: 21
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..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39575
    
  27
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting TIFF to PDF
 
Similar Threads
Am merging images using JAI pls tell it has merging first page of image
XML Parsing problem
problem with socket connecting??
TIFF. DOC, EXCEL to PDF Converter
Retreving PDF File from Database using Java