Is there a way to dynamically embed PDF Files in a

2019-07-17 11:26发布

I understand that it is possible to embed a PDF that is located on the server (ex: <object data="pdf/Test.pdf"/> however is it possible to somehow embed a PDF that's located within the filesystem?

ex: <iframe src="\\filesystem\some\where\in\here\pdf.pdf"></iframe>

If not are there any tricks to doing so?

1条回答
太酷不给撩
2楼-- · 2019-07-17 11:29

Check out my previous answer, instead of sending image data you can send pdf data to display. It is implemented using servlet.

Example:

<iframe src="../loadPdf/pdfFileName.pdf" width="800px" height="600px" >

<servlet>
    <servlet-name>SendPdfData</servlet-name>
    <servlet-class>com.YourServletClass</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>SendPdfData</servlet-name>
    <url-pattern>/loadPdf/*</url-pattern>
</servlet-mapping>

Take reference from my previous answer to know how to send file data from YourServletClass servlet.

查看更多
登录 后发表回答