Quantcast
Channel: Adobe Community : Discussion List - Acrobat Reader
Viewing all articles
Browse latest Browse all 61627

Client side - silent print of PDF

$
0
0

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{

 

        response.setContentType("application/pdf");

 

        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;");

 

            javascript.append("this.print(params);");

           

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

            writer.addJavaScript(pdfAction);

           

            stamper.close();

 

        } catch (DocumentException de) {

            de.printStackTrace();

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

        } catch (Exception e) {

            e.printStackTrace();

        }

    }

}


Viewing all articles
Browse latest Browse all 61627

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>