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 (alternately
NS_ERROR_FAILURE or "memory access out of bounds") if you initially 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;.
If you update the version of PDFNet you're using to generate XOD files you might receive this error, as the XOD files may not be compatible with your WebViewer version. To fix this, you can update WebViewer to the latest version or you can use the "silverlight/flash compatible" option when generating XOD files.
The reason it is called "silverlight/flash compatible" is because these XOD files work with older versions of WebViewer that used Silverlight and Flash, but these older XOD files will also work with older (but not that old) WebViewer clients so you can avoid updating your WebViewer client even after updating the version of PDFNet that you use to convert to XOD. You can find out more about this option here.
Get the answers you need: Support