krislioe Posted August 29, 2009 Share Posted August 29, 2009 dear sirs,I am new to Jasperreport.In our JSF/JSP application we have requirement to print Invoice and Ticket from client side on web browser.We cannot accept the current solution using PDF because we dont want user to be able to save the PDF.So this is the requirement :1) User preview the report then click button "print", the report get printed to printer (Must Not use PDF here)2) When user Click button "print" we want to execute Java code to update a table through JDBC call.Can JasperReport fit these requirements ?Thank you,Krist Link to comment Share on other sites More sharing options...
mouseman Posted August 29, 2009 Share Posted August 29, 2009 I'm new to JasperReports, too, so this is just speculation.One option might be using an applet. It could be as simple as hooking up a JViewer to read the JPrint object from a separate query back to the server. e.g. page A has a print button that starts an applet, which makes a request back to page B the server side. Page B would return just the XML: JasperExportManager.exportReportToXml(print); and then back on the client side (in the applet):// Do what you have to do to get the XML from the server as reportXml, and then ...JFrame frame = new JFrame(frameTitle);frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);try{ ByteArrayInputStream inputStream = new ByteArrayInputStream(reportXml.getBytes()); JRViewer viewer = new JRViewer(inputStream, true); frame.add(BorderLayout.CENTER, viewer); frame.setSize(1024, 748); frame.setVisible(true);}catch (JRException e1){ e1.printStackTrace();}This gives you a nice windowed preview of the report, with a convenient print button. I haven't tried this in an applet, so you might have to make some use of jarsigner ... hope you have your certificate already!Chris Link to comment Share on other sites More sharing options...
teodord Posted August 30, 2009 Share Posted August 30, 2009 Hi, This applet approach is shown in the /demo/samples/webapp sample provided with the JR project package.Note that among the JR downloads there is an applet JAR, for the purpose. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
krislioe Posted August 30, 2009 Author Share Posted August 30, 2009 Hi Sirs,Thank you for valuable response.Tomorrow I will start my journey with Jasper.Thank you,Krist Link to comment Share on other sites More sharing options...
sergeleo Posted August 31, 2009 Share Posted August 31, 2009 del Post Edited by sergeleo at 08/31/2009 02:45 PM Link to comment Share on other sites More sharing options...
sowjigutla Posted February 9, 2010 Share Posted February 9, 2010 Please find the solution in the following URLhttp://helptodeveloper.blogspot.com/2010/02/way-of-printing-jasper-report-at-client.html Link to comment Share on other sites More sharing options...
vin070 Posted February 18, 2016 Share Posted February 18, 2016 Does anyone have a solution for this ? Would greatly apprecaite. Using JSF with Spring & Hibernate. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now