# Understanding the Package Structure

# Package introduction

Foxit PDF SDK for Web provides two packages as follows:

  • Light package: FoxitPDFSDKForWeb_version_0_0.zip (excludes font resource files)
  • Full package: FoxitPDFSDKForWeb_version_0_0_Full.zip (includes font resource files)

If you already have the font resources or only want to use online fonts, you can choose the light package. If you don't want to make any change on the font library and don't care the package size, the full package is the most suitable choice.

The package contains the following folder structure:

Folder Description
docs Contains API reference documents and Foxit PDF SDK for Web's developer guide.
examples A series of demos and examples of how to take advantage of all Foxit PDF SDK for Web features.
external Font resources (only In JR full package).
integrations Integration samples for wrapping Foxit PDF SDK for Web into current popular JavaScript frameworks (AngularJS/React.js/Vue.js).
lib Foxit PDF SDK for Web core libraries.
server http-server and the Node.js scripts for a series of server-based utility applications to use in the viewer.
legal.txt Legal and copyright information.
package.json Project description file.

The lib folder's file structure is provided as follows:

Folder/File Description
jr-engine Front-end rendering engine.
locales Internationalized entries data for using the viewer in different languages. Every language is placed in a different directory with its own label.
PDFViewCtrl Plugins for the PDFViewCtrl library.
stamps Stamps resources, image files and templates.
uix-addons All plugins for the UIExtensions project.
adaptive.js A responsive design script to adapt the viewer to mobile devices
PDFViewCtrl.css CSS file for the PDFViewCtrl viewer UI style.
PDFViewCtrl.full.js Complete script file for the PDFViewCtrl viewer library.
PDFViewCtrl.js Script file for the PDFViewCtrl viewer library without third-party libraries.
PDFViewCtrl.polyfills.js Browser-adapted polyfill script file for the PDFViewCtrl viewer library.
PDFViewCtrl.vendor.js Third-party libraries script used by PDFViewCtrl (See the lists later).
preload-jr-worker.js Worker script for loading resources of JS engine in parallel to the UI for improving the viewer loading speed.
UIExtension.css The default CSS file of the UI.
UIExtension.vw.css The CSS file using vmin unit.
UIExtension.full.js Complete script file for the UIExtension full-featured viewer library.
UIExtension.js Script file for the UIExtension viewer library without third-party libraries
UIExtension.polyfills.js Browser-adapted polyfill script file for the UIExtensions viewer library.
UIExtension.vendor.js Third-party libraries script used by UIExtension (See the lists later).
WebPDFJRWorker.js Script files running in the Web Worker, which are used for calling the front-end rendering engine.
WebPDFSRWorker.js Script files running in the Web Worker, which are used for calling the server rendering engine.

# Package.json

Foxit PDF SDK for Web provides a package.json file to help developers quickly deploy and use the SDK, and make it easy to integrate into their project. The content is as follows:

{
    "name": "foxit-pdf-sdk-for-web",
    "version": "8.2",
    "description": "Foxit pdf sdk for web.",
    "author": "Foxit Software Inc.",
    "main": "./lib/PDFViewCtrl.full.js",
    "scripts": {
        "start": "concurrently --kill-others \"npm run start-http-server\" \"npm run start-snapshot-server\" \"npm run start-collaboration-server\"",
        "start-snapshot-server": "node ./server/snapshot/src/index -p 3002",
        "start-http-server": "node ./server/index",
        "start-collaboration-websocket-server": "node ./server/collaboration-websocket-server/src/index.js -p 9111",
        "start-collaboration-server": "node ./server/collaboration-sockjs-server/src/index.js -p 9112"
    },
    "devDependencies": {
        "boxen": "^4.1.0",
        "chalk": "^2.4.1",
        "concurrently": "^4.1.0",
        "http-proxy-middleware": "^0.19.1",
        "koa": "^2.7.0",
        "koa-body": "^4.0.4",
        "koa-body-parser": "^1.1.2",
        "koa-router": "^7.4.0",
        "koa2-connect": "^1.0.2",
        "lru-cache": "^4.1.3",
        "raw-body": "^2.3.3",
        "require-dir": "^1.0.0",
        "serve-handler": "^6.0.2",
        "sockjs": "^0.3.21",
        "koa-cors": "0.0.16",
        "koa-serve-list": "^1.0.1",
        "koa-static": "^5.0.0",
        "nodemon": "^2.0.6",
        "ws": "^7.3.1"
    },
    "serve": {
        "port": 8080,
        "public": "/",
        "proxy": {
            "target": "http://127.0.0.1:3002",
            "changeOrigin": true
        }
    },
    "collaboration-websocket": {
        "target": "http://127.0.0.1:9111",
        "changeOrigin": true,
        "ws": true
    },
    "collaboration-sockjs": {
        "target": "http://127.0.0.1:9112",
        "changeOrigin": true,
        "ws": true
    }
}

# The third-party libraries used in Foxit PDF SDK for Web

Foxit PDF SDK for Web provides its script files in two versions: the full version script, that includes the third-party libraries, and the regular script, without any third-party libraries. If your project already uses the dependencies included in the SDK's third-party libraries, you don't need to re-install them.

The PDFViewCtrl.full.js script contains:

  • PDFViewCtrl.full.js:Complete script file for the PDFViewCtrl viewer library.

  • PDFViewCtrl.polyfills.js:Browser-adapted polyfill script file for the PDFViewCtrl viewer library.

  • PDFViewCtrl.vendor.js:Third-party libraries script used by PDFViewCtrl (See the list of vendors below this section).

  • PDFViewCtrl.js:Script file for the PDFViewCtrl viewer library without third-party libraries.

So, PDFViewCtrl.polyfills.js + PDFViewCtrl.vendor.js + PDFViewCtrl.js = PDFViewCtrl.full.js.

Essentially, the two scripts below are the same thing:

<script src="../FoxitPDFSDKForWeb/lib/PDFViewCtrl.full.js"></script>

and

<script src="../FoxitPDFSDKForWeb/lib/ PDFViewCtrl.polyfills.js"></script>
<script src="../FoxitPDFSDKForWeb/lib/PDFViewCtrl.vendor.js"></script>
<script src="../FoxitPDFSDKForWeb/lib/PDFViewCtrl.js"></script>

The third-party libraries contained in PDFViewCtrl.vendor.js are outlined below:

jquery
i18next
i18next-chained-backend
i18next-localstorage-backend 
i18next-xhr-backend
jquery-contextmenu
dialog-polyfill
hammerjs
eventemitter3 

The UIExtension.full.js script contains:

  • UIExtension.full.js:Complete script file for the UIExtension viewer library.

  • UIExtension.polyfills.js:Browser-adapted polyfill script file for the UIExtension viewer library.

  • UIExtension.vendor.js:Third-party libraries script used by UIExtension (See the list of vendors below this section).

  • UIExtension.js:Script file for the UIExtension viewer library without third-party libraries.

So, UIExtension.polyfills.js + UIExtension.vendor.js + UIExtension.js = UIExtension.full.js.

Essentially, the two scripts below are the same thing:

<script src="../FoxitPDFSDKForWeb/lib/UIExtension.full.js"></script>

and

<script src="../FoxitPDFSDKForWeb/lib/UIExtension.polyfills.js"></script>
<script src="../FoxitPDFSDKForWeb/lib/UIExtension.vendor.js"></script>
<script src="../FoxitPDFSDKForWeb/lib/UIExtension.js"></script>

The third-party libraries contained in UIExtension.vendor.js are outlined below:

jquery
i18next
i18next-chained-backend
i18next-localstorage-backend
i18next-xhr-backend
dialog-polyfill
hammerjs
eventemitter3
file-saver