Show PDF file inside web browser using iText

I developed a report (without and regardless of any db data source) only with iText. I know JasperReportsthis is easy. But in my case, I just store the report in pdf format, or I used acrobat for java beans to show the report to the user. Now I need to change the implementation code to show this report in a web browser instead, to save it in a file.

How can i do this?

+3
source share
2 answers

You need 2 thoughts, first the browser plug-in installed in the browser, and the second to set the content placement header as built-in respose, otherwise the browser will try to load it.

response.setHeader("Content-Disposition","inline; filename=\"file.pdf\""); 

, /pdf , iText bytearray .

: , , , , pdf, pdf pdf.

+6

, PDF , .

, , pdf, :

<a href="your.pdf">link to your pdf</a>

, html- pdf?

+1

Source: https://habr.com/ru/post/1791686/


All Articles