Some test text!

Loading errors

Contents

GET /ui/index.html 404
Invalid XOD file, signature is wrong
Not allowed to load local resource: file:///...
Failed to load document. The document is either corrupt or not a valid PDF document.
Invalid XOD file: Zip end header data is wrong size!
getComputedStyle is null

linkGET /ui/index.html 404 (Not Found)

Try adjusting the path option in the PDFTron.WebViewer constructor so that it points to the location of your lib folder.

linkInvalid XOD file, signature is wrong

If you're trying to load a PDF document and the URL doesn't have an extension you might get this error. You can let WebViewer know that it should treat this file as a PDF by passing the option documentType: 'pdf' to the PDFTron.WebViewer constructor.

linkNot allowed to load local resource: file:///...

Note because of browser security restrictions you will not be able to run WebViewer from the file system. Instead you can run it from a local server, or use the WebViewer integrated server.

linkFailed to load document. The document is either corrupt or not a valid PDF document.

If you are trying to load a PDF file then you should try opening the document in another PDF viewer to confirm that it loads. If it doesn't load in any other viewers then your PDF file may be corrupt or invalid.

This error may also occur if you're loading a XOD document but WebViewer thinks you want to load a PDF. By default WebViewer will look at the extension of the path that you pass to initial doc and if it ends in .pdf it will treat the document as a PDF. You may see an error that looks like:

Error: Exception:
   Message: Header not found
   Filename:
   Function: SkipHeader
   Linenumber:

If your file path looks something like myserver.com/conversion-to-xod.asp?doc=GettingStarted.pdf then WebViewer will treat it as a PDF file because of the extension at the end. To override this you can pass the option documentType: 'xod' to the WebViewer constructor. This will force WebViewer to treat the document as a XOD file.

linkInvalid XOD file: Zip end header data is wrong size!

This error usually means that your server does not support HTTP range requests properly. Instead of downloading a small part of the file it is downloading the entire file.

If you're serving your files statically from your server usually range requests will just work, however if you have your own endpoint for the file there are libraries that can handle range requests for you, or you could implement it support yourself.

As a last resort you can set the streaming option in the WebViewer constructor to true. This is intended for streaming of the XOD conversion but can be used as a workaround for servers that don't support range requests at the cost of reduced performance and increased memory usage. See this guide for more information.

linkgetComputedStyle(...) is null

You might get this error in Firefox if you intially have the element that contains WebViewer set to display: none. You can follow the Firefox bug tracking this issue here https://bugzilla.mozilla.org/show_bug.cgi?id=548397.

To work around this bug you can instead set the element to visibility: hidden or height: 0; width: 0;.

Get the answers you need: Support

Contents

GET /ui/index.html 404
Invalid XOD file, signature is wrong
Not allowed to load local resource: file:///...
Failed to load document. The document is either corrupt or not a valid PDF document.
Invalid XOD file: Zip end header data is wrong size!
getComputedStyle is null