1 Reply Latest reply on Apr 3, 2017 1:45 AM by haxtbh

    Automatically display print dialog in PDF generated with cfdocument.

    BretReece

      Hey All,

       

      I'm pretty new to CF, but learning more every day. I'm using cfdocument to serve up a PDF in the browser when the user clicks on a 'print' button in my app. That works fine, but what I'd really like is for the document to come up in the browser AND the print dialog to come up with it, as if the user had clicked the print icon after the document loaded.

       

      The reason I want this behavior is that to get to this point, the user has already clicked a 'Print' button in my web app. I don't want them to have to click that, then see the file, then have to click print again, then have to click print yet again on the print dialog.

       

      Here's a link to a PDF that I found that exhibits the behavior I want. http://www.fpdf.org/en/script/ex36.pdf .

       

      Here's the code I'm using to generate the PDF:

       

      <cfdocument format="PDF" orientation="landscape">

          <cfoutput>

              <h1>This is a test.</h1>

              <h4>I'd like the print dialog to pop up automatically when this PDF file is displayed.</h4>

          </cfoutput>

      </cfdocument>

       

      Any help or pointer in the right direction would be very much appreciated.

       

      Thanks,

      Bret