• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing textual data from browser

 
Jeevan Sunkersett
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Ours is a web based (Struts, Spring, Hibernate) application.
In a particular use case, print-receipt; we pull up data from database and display it a new window ... followed by a javascriptLwindow.print()

To print the content.

But this prints the browser window - in graphic mode.

The target printer, attached to the browser machine is a Dot matrix printer; and consumes a lot off time to print a single window (because of the graphic nature)

Can the printing be done in text mode ?

thank you.
jeevan




 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can either:
  • Use CSS to control what gets printed.
  • Instead of window.print(), have the link serve a PDF of just the data you want to print.
  •  
    Pete Nelson
    Ranch Hand
    Posts: 147
    Debian Eclipse IDE Tomcat Server
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I don't know that JSP will offer you much in terms of client-side printing. However ...

    Depending on the Browser you are using, you may be able to take advantage of CSS to change the way the page prints.

    Here's a good starting point for CSS for print media - http://www.w3schools.com/css/css_mediatypes.asp
     
    Jeevan Sunkersett
    Ranch Hand
    Posts: 78
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    HI,

    for the benefit of everyone, this solution worked for me;

    http://www.codingforums.com/showthread.php?p=1125268

    ~jeevan
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic