This is a proxy solution to use with WebViewer-HTML that allows loading external HTML web pages so that HTML pages can be annotated.
See the npm package on @pdftron/webviewer-html-proxy-server for more information.
Methods
-
<static> createServer(options)
-
Initializes the proxy server to load external HTML pages.
Parameters:
Name Type Description optionsobject The options objects containing SERVER_ROOT, PORT. Properties
Name Type Argument Description SERVER_ROOTstring Start the server on the specified host and port PORTnumber Start the server on the specified host and port CORS_OPTIONScors.CorsOptions <optional>
An object to configure CORS. See https://expressjs.com/en/resources/middleware/cors.html COOKIE_SETTINGexpress.CookieOptions <optional>
An object to configure COOKIE. See https://expressjs.com/en/api.html#res.cookie ALLOW_POTENTIALLY_UNSAFE_URLboolean <optional>
Boolean containing value to disable URL validation. Setting this to true will override ALLOW_HTTP_PROXY. ALLOW_HTTP_PROXYboolean <optional>
Boolean containing value to allow loading localhost files and for unsecured HTTP websites to be proxied. Returns:
- Type
- void
Example
const HTMLProxyServer = require('@pdftron/webviewer-html-proxy-server'); HTMLProxyServer.createServer({ SERVER_ROOT: `http://localhost`, PORT: 3100 });