Some test text!

menu
search

Create PDF document

Creating a PDF document is similar to creating a XOD document except it requires a few more steps: we need to initialize the PDF worker based on the backend type for the browser we are using.

// Instantiate a Document object.
const doc = new CoreControls.Document('YOUR_FILE_ID', 'pdf');

CoreControls.getDefaultBackendType().then(backendType => {
  // Determine the PartRetriever that should be used.
  // If you are loading the PDF file as a Blob, you need to use PartRetrievers.LocalPdfPartRetriever
  const partRetriever = new CoreControls.PartRetrievers.ExternalPdfPartRetriever('YOUR_PDF_FILE_PATH');
  const options = {
    workerTransportPromise: CoreControls.initPDFWorkerTransports(backendType, {}, 'YOUR_LICENSE_KEY')
  };

  doc.loadAsync(partRetriever, error => {
    // The PDF file has been created, you can call APIs of the Document class
  }, options)
});

Get the answers you need: Support

close

Free Trial

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.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn more
close