Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Printing textual data from browser

 
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




 
Marshal
Posts: 67415
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
  •  
    Ranch Hand
    Posts: 147
    Eclipse IDE Tomcat Server Debian
    • 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
     
    Politics is a circus designed to distract you from what is really going on. So is 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
      Bookmark Topic Watch Topic
    • New Topic