• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Help using javax print package. How to LANDSCAPE?

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
I really need some advice with this topic. How do you send down a text file to a default printer in LANDSCAPE orientation, using javax.print package. It is a report I'm printing, no image is required.
I have this code,
DocFlavor printFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
Doc printDoc = new SimpleDoc(in, printFormat, null);
PrintRequestAttributeSet printAttribs = new HashPrintRequestAttributeSet();

PrintService[] printers = PrintServiceLookup.lookupPrintServices(printFormat, printAttribs);
//default printer
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob job = service.createPrintJob();
try {
job.print(printDoc, printAttribs);
} catch (Exception e) {
A portrait report always get printed with the above code. Why???
Please help...
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!