aspose file tools*
The moose likes I/O and Streams and the fly likes Printing .tiff Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Printing .tiff Files" Watch "Printing .tiff Files" New topic
Author

Printing .tiff Files

Mikealan Smith
Greenhorn

Joined: Aug 29, 2003
Posts: 15
First let me say, i'm pretty much a noob to java.

Here is what i need to do.
Read a windows directory containing thousands of .tiff images.(i have this much working)
Then as i read each image file, i want to send this to a Specific printer using the printers defaults.
so i don't want to have a dialog box, i want to have this automated.

Is there a way to accomplish this? I have been searching for 2 days, but i have found anything that i make enough sense of to use.
It looks like the java2d apis don't handle .tiff files.

Any help is greatly appreciated.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42947
    
  70
It looks like the java2d apis don't handle .tiff files.

With a little effort they do. See this post of mine for how to add TIFF support to the ImageIO class. That'll create a BufferedImage image object of the TIFF.
Mikealan Smith
Greenhorn

Joined: Aug 29, 2003
Posts: 15
Ulf,
Thanks for the reply.
Would you be able to share a bit more on how to use this?

Also,
i figured out how to make it use a default printer, but in my case i'm printing to a file, so it still receives a dialog box to enter the file name. I need to find a way to make the file name the name of my tiff, so that i would have something like 00001.tiff would create a file named i00001.psg

Any ideas?

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42947
    
  70
Would you be able to share a bit more on how to use this?

About what, exactly? You download the library, add it to the project's classpath, add 3 lines of code, and you're done. And you may not even need the 3 lines of code, as the last post on that topic mentions.
Mikealan Smith
Greenhorn

Joined: Aug 29, 2003
Posts: 15
Hi, Ulf,
Sorry if i'm being dense about this, but i'm confused. I have it downloaded, and added the 3 lines of code, but i can't figure out what it does for me. Maybe it means i don't need some of my existing code. Does this mean that i don't need the DocFlavor etc?

I'm attaching my code, with the realization that it doesn't exactly work.



Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42947
    
  70
No, it doesn't handle any part of printing; it does exactly what I quoted in my first post - add TIFF support to Java2D, and more specifically, allow the ImageIO class to read and write TIFF images. That gives you a BufferedImage object that you can draw on a JPanel that implements Printable (should be pretty basic), so that you can print it using a PrinterJob.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing .tiff Files