iText generated PDF not shown correctly in Chrome

前端 未结 2 634
萌比男神i
萌比男神i 2021-01-27 13:10

I am using the iText library in Java to generate a pdf file. The idea is that a user fills in some information and that when the user clicks on the generate button the pdf is sh

相关标签:
2条回答
  • 2021-01-27 13:33

    Does chrome open the PDF and then not render it correctly? In that case, please open an issue at http://new.crbug.com and attach an example PDF file that shows the problem. Reply with the issue number here.

    0 讨论(0)
  • 2021-01-27 13:34

    The way that I have achieved this in the past is by creating a seperate Servlet to serve PDF documents directly. In the web.xml file you would specify the servlet mapping to *.pdf.

    What you can do then is rather than override the FacesServlet response bytes to server the PDF file you just redirect the response to filename.pdf, passing needed parameters in the URL.

    Your PDF servlet can actually do the work of building the necessary PDF, it will open in a seperate tab and the URL will match the response redirect.

    0 讨论(0)
提交回复
热议问题