开发者

viewing a client-side pdf in a jsp

开发者 https://www.devze.com 2023-01-31 08:10 出处:网络
How do I show a client-side pdf (i.e. a preview of a file on their hard-drive) in a jsp? I can embed a server-side pdf:

How do I show a client-side pdf (i.e. a preview of a file on their hard-drive) in a jsp?

I can embed a server-side pdf:

<embed src="fw4.pdf" name="preview_image" width=400 height=800
border=0 type="application/pdf" PLUGINSPAGE="http://www.adobe.com/downloads/"&g开发者_JAVA百科t;

I can preview a client-side img:

<img src="file:\\\\C:\\temp\\IMG_9990_w.jpg" name=preview_image height="600" width="600">

How do I preview a client-side pdf?

I have tried using iframes, embed tags (with the path similar to one in the img tag above), etc., etc.. Any suggestions?


Just define its path in embed src the same way as you did for img src.


Update: OK, that didn't work. The case which you have there is also pretty rare though. Normally PDF's and all other embedded stuff is served by the webserver, not loaded from the client's local disk file system. Why this requirement? Is it an intranet webapplication which is accessing some shared network drive which is supposed to be available on all client machines?

If that is indeed the case, then I'd attach that network disk on the webserver as well and just use a servlet to stream the bytes unchanged from that disk to the HTTP response and then let the embed src point to that servlet.

If that is not the case, then I really don't see any sensible reasons to design your webpage like that, or it must be for some specific personal purposes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号