Print PDF content as HTML images in Cache/CSP/ZEN/JavaScript


   I have a ZEN application that displays PDF files in an 'iframe', embedded on a ZEN popup dialog. embedded in a ZEN page running on IE 11 with its document mode set to 5, which is enough to make most reasonable people give up and start selling hot dogs in the park.

  I can display the PDF all day long without issue but when the "window.print()' command is issued all I get for the PDF is an empty area on the printed page when a single page of the PDF should be displayed. The PDF arrives as a normal PDF file and is NOT base64 encoded. I have had limited success using the PDF.js library but only when the document mode is set to 'Edge' and not '5'. Unfortunately I cannot change the document mode due to compatibility issues with client configurations. And of course all of this works great in Chrome however Chrome is not the supported browser within the organization I work for.

   So I would like to know if anyone has every successfully transformed a PDF file using Cache and/or JavaScript or both into one or more HTML image controls for placement on an HTML page? If  you have then please let me know how you did it so I can see if it will work for my situation.

Gary L. Marston

Senior Cache Developer

  • 0
  • 0
  • 561
  • 3
  • 1


You can draw ZEN with PDF into a new PDF using headless chrome browser (server-side) and send this new PDF to client for printing.

Hi Eduard,

   Thanks for the suggestion!

    Would you happen to have an example code snippet you could share? I have seen references to using headless Chrome instances but have never tried it from within Cache. Anything you can offer would be deeply appreciated.



chrome --headless --disable-gpu --print-to-pdf

Referenced article also shows several examples.

Chrome could be called with $zf(-1) function.