Some test text!
WebViewer's standard API provides document viewing and basic PDF manipulation APIs, but doesn't provide more advanced document processing APIs.
PDFTron provides a cross platform document processing API and the WebViewer full API is the in-browser JavaScript implementation of this. The PDFTron C++ SDK is converted to a WebAssembly module allowing the same APIs to be used directly in the browser. Tasks that previously would have required a server can now be done completely client side.
See the full API samples for an example of this functionality.
When using the default WebViewer UI you can enable the full API by passing the fullAPI
option into the WebViewer initializer. This will make the PDFNet
namespace available on the WebViewer instance and allow you to access a PDFDoc instance from the WebViewer document object.
WebViewer({
licenseKey: 'Insert commercial license key here after purchase',
initialDoc: 'YOUR_FILE.pdf',
fullAPI: true
}, viewerElement).then(instance => {
// PDFNet is only available with full API enabled
const { PDFNet, docViewer } = instance;
docViewer.on('documentLoaded', () => {
await PDFNet.initialize();
const pdfDoc = await docViewer.getDocument().getPDFDoc();
// access additional functionality on the PDFDoc object
// e.g. pdfDoc.fdfMerge(...)
});
})
You can also load it without a viewer by including the PDFNet.js
script along with CoreControls.js
directly in your page. See this guide for more details.
The reason why the full API isn't enabled by default is that the full API WebAssembly module is ~2-3 times larger than the default client side module that only supports rendering. This means that it will take a longer to download and process, affecting the WebViewer start up time.
If you don't require any of these APIs then it doesn't make sense to load the full API and have a slower start up time. If you are only viewing and annotating documents then you most likely do not need to enable the full API.
Although the full API will run on any browser or device, the performance may not be acceptable on mobile devices and older browsers like IE11. If you need to support these browsers or devices we recommend using a custom server and performing the processing on the server side.
You can load the full API with or without the default viewer. With the default UI you can manipulate the document using the PDFNet
APIs and then refresh it in the viewer. Alternatively you can process a document in the background without rendering pages at all.
CoreControls.js
and PDFNet.js
are loaded directly inside your web app. See this guide for more details.
Below is an expanded diagram of the default UI that shows the how the full API is loaded when running with the viewer. For more information about running with the default viewer and how it works behind the scenes see here.
Get the answers you need: Support
Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.
Select a platform to get started with your free trial.
Web
Android
iOS
Windows
Linux
Unlimited usage. No email address required.