Some test text!
Try adjusting the
path option in the PDFTron.WebViewer constructor so that it points to the location of your lib folder.
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
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.
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.
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