Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I dont think this is possible. The PDF will open in the users default PDF application. This could be anything. You also dont have access to control this application to tell it to print it either.
Some browsers may do something similar, i.e. chromes kiosk printing but generally you will not be able to achieve this.