0

How to trigger print if I am using dompdf stream and displaying using blob.

I am using laravel dompdf and vuejs.

I am able to display pdf in modal.

Now I Need to open print dialogue using my print button not from pdf.(Its client requirement)

I tried some solution like :

  1. https://stackoverflow.com/a/12444702 (saying "document is not ready to print", obviously print() triggers before pdf loading.)
  2. https://stackoverflow.com/a/16239785 (Goes to infine loop always get undefined)
  3. https://stackoverflow.com/a/6010113 (Only works in chrome, in firefox Error: Permission denied to access property "print")

Please help me to achieve this.

Community
  • 1
  • 1
GRESPL Nagpur
  • 2,048
  • 3
  • 20
  • 40
  • So you want to trigger printing the PDF by using a button in an HTML page? What is your modal setup? Using frames/iframes or a PDF embedded in the HTML? – BrianS Dec 28 '16 at 14:29
  • Currently I am using tag, but I am ready to use anything to get this done – GRESPL Nagpur Dec 29 '16 at 05:48
  • 1
    It's a big kludgey, but you could have the button trigger a re-render of the PDF. The second render would include some PDF JavaScript to initiate a print. Try rendering [this document](https://github.com/dompdf/dompdf/blob/v0.6.2/www/test/script_javascript.html). Ensure dompdf is [configured to include PDF JS](https://github.com/dompdf/dompdf/blob/v0.7.0/src/Options.php#L176) in the render (the default). Of course, whether or not it works depends on the viewer application. – BrianS Dec 30 '16 at 19:05

0 Answers0