How to render a file in a frame?

1

I use a service that returns a file in PDF, I have a web application that I currently do a Windows open on the service call and downloads the file.

However, I now need to render this file in order to generate the automatic print of it.

Does anyone know how I can render this file through an Ajax or frame request? In order to try somehow to print?

My code is window.open (url)

    
asked by anonymous 13.01.2018 / 00:03

1 answer

0

You can use a PDF renderer fully written in HTML5 / JavaScript (not using libraries or external frameworks) and compatible with all modern browsers called pdf.js . In addition to displaying the PDF on the page, it has many features (including printing).

You can download the package directly from the component page: link

When uploading the component files to the server, there is a file named viewer.html within the web folder that renders the PDF. You can call this file via window.open by sending the ?file parameter to the URL with the name of the PDF you want to open. Example:

window.open('viewer.html?file=ARQUIVO_PDF.pdf','_blank','width=1000, height=500');
    
14.01.2018 / 00:29