Win a copy of Head First Android this week in the Android forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Print in LANDSCAPE orientation ????

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello --
I have a JSP site that I have just added a reports section to. One of the reports has 14 columns of data. Printing this in portrait orientation truncates some of the columns. Therefore, I need to print this report in landscape orientation instead of portrait. How do I programmatically change the page setup to use landscape orientation and then when it is finished to reset the orientation to portrait? Is this possible? If not, are there any workarounds available? I have some users who are not familiar with using computers at all; to train them to go to File --> Page Setup --> change the orientation to landscape --> Print the document --> File --> Page Setup --> change the orientation back to portrait each time is not an acceptable solution.
Any suggestions or feedback is greatly appreciated!
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I googled for the answer, I thought it would be javascript. But it turns out CSS2 has an answer.

Here's what I could find: http://www.course.com/downloads/newperspectives/crweb2/dhtml/T7.html#Printing
http://www.blooberry.com/indexdot/css/properties/print/size.htm

Also when I googled, I found someone else on JavaRanch who had asked the same question, and they had no reply (until today that is).

 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mike,
Thanks for your reply. I found the first link on google as well. I tried it, but I couldn't get it to work. I also found another link on google with this CSS2 reference but it said that no major browser supports this feature. I only need it to work in IE 4+ (intranet app so we can control the browser). Any other ideas?
 
Saloon Keeper
Posts: 24533
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Been there, did that. Printed to a PDF set to Landscape using the retepPDF API (now GnuJPDF). You can find it on SourceForge.
Or, I think there's some commercial packages if you want fancier PDF's.
PDF's are the format of choice for printing where you care about preserving fonts, layouts, and other formatting info. HTML is a guideline subject to the browser, user, and OS hims, where PDF directives are absolute.
 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim,
Thanks for your response. Is there anyway to accomplish this without using PDF? Using PDF's is not preferred in our environment. I'd like to find an HTML/JSP solution. Can anyone verify what version of browsers support CSS2? I really appreciate your help.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am currently researching this same issue.
I've found this at MS's site:
MSDN Print Help
It says to use ScriptX which is a ActiveX utility put out by MS.
Hope it helps.
 
Ryan Putman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MeadCo's ScriptX
Here's a link to the actual site for the makers of ScriptX.
You can download it here and read any support documents you may need.
Good Luck.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic