• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Printing .tiff Files

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic