Back to Blog

    Developer Blog

    How can I make WebPDF Viewer run successfully if the front-end of WebPDF Viewer is hosted on a different domain from the back-end?

    Foxit WebPDF Viewer - Discontinued

    If your project which needs to be integrated with WebPDF Viewer is in a different domain from the WebPDF Viewer, you need to copy all the static files (front-end) of WebPDF Viewer into the webapp folder of your project. Also, you should modify the parameter of customizedUrl when you initialize the Viewer in ../viewer/webapp/scripts/control/pc/demo.js.

    For example:

    (Code Box) $(document).ready(function() { 
    
    var optionsParams = { language: getLanguage(), customizedUrl:"http://127.0.0.1:8080/viewer/", //change the ip of Url to the one your webpdf viewer install baseUrl: getBaseUrl() }; 
    
    WebPDF.ready(docViewerId, optionsParams).then(function(data) { … … }); });

    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!