2005 IR Help Posted August 27, 2006 Share Posted August 27, 2006 By: mozart - mozart_sk8 printing documents in the client side 2004-09-02 03:12 Good afternoon, I'm having problems with regards to printing of documents in the client side. This is what happend. I have developed a report generator. The problem is that it seems that it tries to print on the serverside what I want is that I want my documents to be printed on the clientside. Do I have to implement my application in applet? so that the document can be printed in the client side and not on the serverside. I would really appreciate if someone could help me By: mozart - mozart_sk8 RE: printing documents in the client side 2004-09-02 04:59 do you a sample code on how to do this? I would really appreciate if you could share it with me By: Juby Victor - jubyvictor RE: printing documents in the client side 2004-09-02 05:13 OutputStream opPDFStream = (ByteArrayOutputStream)new ByteArrayOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint,opPDFStream); request.getSession().setAttribute("certificatePDF",opPDFStream); the jsp that will print the stuff will be <%@ page import="java.io.*"%><% response.setContentType( "application/pdf" ); StringBuffer sbFilename = new StringBuffer(); sbFilename.append("generatedPDf_"); sbFilename.append(System.currentTimeMillis()); sbFilename.append(".pdf"); StringBuffer sbContentDispValue = new StringBuffer(); sbContentDispValue.append("inline"); sbContentDispValue.append("; filename="); sbContentDispValue.append(sbFilename); ByteArrayOutputStream buffer = (ByteArrayOutputStream)session.getAttribute("certificatePDF"); DataOutput output = new DataOutputStream( response.getOutputStream() ); byte[] bytes = buffer.toByteArray(); response.setHeader( "Content-disposition", sbContentDispValue.toString()); response.setContentLength(bytes.length); for( int i = 0; i < bytes.length; i++ ) { output.writeByte( bytes ); } %> By: mozart - mozart_sk8 RE: printing documents in the client side 2004-09-02 21:59 correct me if I'm wrong if I'm going to analyze the source codes it seems that first the reports will be displayed in the pdf format and from there we can print already the document. Am I right? If I am, that's not what I want, what I want is that I have a page in my browser then once I want to print my documents it will print right away in my printer. I dont want to open the pdf file and once the file is open I still have to click the print button. I would really appreciate if you could help me again tnx By: Juby Victor - jubyvictor RE: printing documents in the client side 2004-09-02 04:30 You can create a pdfStream and then put it into the sesssion , and then use the stream from the client side, hth By: Chetan - someone_genius RE: printing documents in the client side 2004-10-18 23:10 Hello I am doing is this way. Geting HTML output as BufferString. Printing same in a hidden frame and then printing hidden frame. It is working fine here and I guess this is the only solution. Reg, Chetan 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