Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing Records Directly To Printer

Posted on 2006-11-30
5
Medium Priority
?
279 Views
Last Modified: 2010-04-01
Hi

I have a situation where i have records on the webpage with the 'Details' button with every records which shows the details of every record and then it prints the record when you go into the detail.jsp page. I want to give an option on the existing page where you can print all the records to the printer directly from the database without going to the details.jsp of that record.
0
Comment
Question by:rifaquat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 29

Expert Comment

by:bloodredsun
ID: 18053184
>>I want to give an option on the existing page where you can print all the records to the printer directly from the database without going to the details.jsp of that record.

You can't.

For security reasons, you do not have native access to the users system, including the printer. You can request that a page is printed by using the javascript command window.print() . You will need to use a JSP which connects to the database and retrieves the data and then generates the output, either as HTML which can be printed or as a PDF using something like iText or XSL-FO which can then be saved or printed.
0
 

Author Comment

by:rifaquat
ID: 18053482
We are actually using Hibernate for interacting with the database and Velocity Templates for presentation layer. Now, i want to print the data in the same format which is actually being shown in Details.jsp page but without actually going into the page I want to provide this service on one click and then it should print all the data to the printer(Client's Printer) one by one while taking all the records from the database on the server. I would appreciate your help if you can provide me some piece of code...Just the overview of business logic not the hibernate stuff.....etc..
Thanks.
0
 
LVL 29

Accepted Solution

by:
bloodredsun earned 400 total points
ID: 18053721
Then you need to create a simple servlet that can dynamically create PDF, that can be downloaded to the client. Look at iText http://www.lowagie.com/iText/ to do this, there are plenty of code examples.

As I said before, you cannot automatically print something from a website. This can only happen if the users browser is set up like this as default behaviour or if there are insecure enough to load something like an ActiveX component.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question