wood burning stoves 2.0*
The moose likes JSP and the fly likes Printing textual data from browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Printing textual data from browser" Watch "Printing textual data from browser" New topic
Author

Printing textual data from browser

Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 77
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

Joined: Jan 10, 2002
Posts: 61648
    
  67

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.


  • [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    Pete Nelson
    Ranch Hand

    Joined: Aug 30, 2010
    Posts: 147

    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

    OCPJP
    In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
    Jeevan Sunkersett
    Ranch Hand

    Joined: Jul 03, 2007
    Posts: 77
    HI,

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

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

    ~jeevan
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Printing textual data from browser