3 Replies Latest reply on Oct 23, 2012 4:27 AM by Dave Merchant

    event handling document sent to printer

    peeteko

      I use a hidden iframe to load a pdf page. the construction of the pfd and the loading is triggered by a button 'print'.

      In the pdf page I have an acrobat javascript

       

      var pp = this.getPrintParams;

      //set parameters

      this.print(pp);

       

      I would like to have some kind of event handle in the html page that is triggered when the document is sent to the printer.

      When I press on print I would like to disable all buttons and links on the page till the moment the document is sent to the printer.

      Now the users often clicks away before the document is fully loaded and printed

       

      Is there a way to handle this?

        • 1. Re: event handling document sent to printer
          Dave Merchant MVP & Adobe Community Professional

          Not sure what you mean. If you want your own "Print" button to affect the document, just add more script to the button's event.

           

          If you want to detect the moment when a user confirms the operating system print dialog (by pressing Print on that dialog), use the willPrint document event - but at that moment the spooled data is locked and changes to the document won't affect what comes out on paper, nor can you cancel the job.

          • 2. Re: event handling document sent to printer
            peeteko Level 1

            I will explain . This is how the system works now. On a html page i have a button. When i press this button the button event will create in the same page an iframe. The source atribute of the iframe points to a servlet. The servlet HttpServletResponse getOutputStream is used to write a pfd file. In the pdf file there is acrobat javascript so that the document is printed automatically (this.print(pp)).

             

            I would like to know if there is some way to have some control in a html page about print statuses of a dynamically created pdf file. Here the document is loaded in an iframe. Maybe another way of working is needed?

             

             

            • 3. Re: event handling document sent to printer
              Dave Merchant MVP & Adobe Community Professional

              If you want the PDF file to send an event message to the JS DOM in the Web browser then use the hostContainer object in Acrobat JavaScript. Be aware that it won't work for most users (anyone using third-party PDF software such as Preview, JavaScript disabled, viewing on iOS devices, etc.) so your page and your PDF file must fail gracefully.