1. Home
  2. Foxit PDF SDK for Web
  3. Is it possible to retrieve a file from an external server using WebPDF Viewer?
  1. Home
  2. Foxit WebPDF Viewer - Discontinued
  3. Is it possible to retrieve a file from an external server using WebPDF Viewer?

Is it possible to retrieve a file from an external server using WebPDF Viewer?

Yes. To achieve the file retrieve using WebPDF Viewer, follow the steps below:

1 – Deploy your own document server. We provide Foxit WebPDF users with a Java sample code for reference. It is available in ‘webpdf\sample\webpdf-extension-sample’, specifically , DocumentController.java
2 – Modify the javascript file apiConfig.js located in ‘webpdf\viewer\webapp\scripts\config’ by removing the comments in the getDocument function of the REST API and replace the “url” field with the address of the server where the document you want is located.
3 – Call

params = { url: the file url}
WebPDF.ViewerInstance.openFileByUri(params)

which will trigger the REST API getDocument , send a HTTP request to the server and retrieve the document.

4 – You may pass your own parameter in the “params” and “heads” field in apiConfig.js

Updated on March 19, 2019

Was this article helpful?

Related Articles