4 Replies Latest reply on Feb 8, 2013 2:17 AM by Lord_Habicht

    Client side - silent print of PDF


      Hey everyone, I need some help here !

      So I want to print with no user interaction some PDF on the client browser.
      For this, I use a servlet and an iframe in my JSP (this way the file is not open).

      It's working pretty fine except it is not completely a silent print since there is a confirmation message from Adobe reader : http://www.freeimagehosting.net/acea3

      So my question is what can I do for prevent this message to show up and print the PDF automatically ? Is there something I can configure in Adobe reader for prevent this confirmation to show up ? (i have access to all the PC users and I can do the trick on all of the PC if it allows me to do what I want).


      For information, here is the servlet code :

      public class PdfPrintServlet extends HttpServlet {



           * Explains how to print silently via Servlet/Browser.

           * @author     Bikram Shrestha, markib@gmail.com


          private static final long serialVersionUID = 1L;


          public void doGet(HttpServletRequest request, HttpServletResponse response)

          throws IOException, ServletException{




              URL url = new URL(request.getParameter("url"));

              try {

                  PdfReader reader = new PdfReader(url);

                  PdfStamper stamper = new PdfStamper(reader,response.getOutputStream());

                  PdfWriter writer = stamper.getWriter();


                  StringBuffer javascript = new StringBuffer();


                  javascript.append("var params = this.getPrintParams();");


                  javascript.append("params.interactive =    params.constants.interactionLevel.silent;");

                  javascript.append("params.pageHandling = params.constants.handling.shrink;");




                  PdfAction pdfAction= PdfAction.javaScript(javascript.toString(), writer);





              } catch (DocumentException de) {


                  System.err.println("document: " + de.getMessage());

              } catch (Exception e) {