Foxit WebPDF Viewer – Discontinued

Can anyone download a PDF viewed using WebPDF Viewer?

No, it’s possible to prevent users from being able to download a PDF which they are viewing through WebPDF Viewer. Please see below for details.

Some users have pointed out that when using the online demo of WebPDF Viewer that the full path to the PDF file is exposed. The demo site is using the API WebPDF.ViewerInstance.openFileByUri to open a document that was considered a public document, as such the URL of the document is put there directly,  but this is just for the demo site and will not be the case in most practical uses.

In practical use cases you will need to build your own file server and set the URL of the doc server in the REST API getDocument — defined in file Apiconfig.js. Hence by calling the API openFileByUri, the REST API getDocument will be triggered and the back-end of WebPDF Viewer will fire a HTTP request to the third party server with the URL and params defined in getDocument, and then receive the PDF datastream from the doc server, render it and return the URL for requesting the parts of the rendered image.

Doing this will mean that the documents are distributed via your own file server without exposing the address of the document. Note that the address of doc server is exposed in APIconfig.js, which will be loaded by the client side front-end, hence you will need to implement your own security settings in the doc server to block un-granted requests. A common way of doing this is to pass the designated parameter in the argument params and heads in ApiConfig.js for authentication (e.g. pass accesstoken for oauth authentication) and they will be passed to the doc server for security control.

Please check the developer guide, section 2 “REST API” for more details on the usage of the REST API. Also, a sample document server is available in the Java maven project located in “webpdf\sample\webpdf-extension-sample”, specifically the file DocumentController.java.

Note: This article refers to a deprecated version of a Foxit Product. If you are still using Foxit WebPDF Viewer, please refer to your download package documents for Developer Guide and API Reference.

Get a trial version of Foxit PDF SDK for Web and see the brand new features we’ve released for our web-based version!

Updated on May 14, 2017

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: