File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing .tiff Files

 
Mikealan Smith
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic