
load and render specific page of the PDF Hide the pdf loader and show pdf containerĭocument.querySelector("#pdf-loader").style.display = 'none' ĭocument.querySelector("#pdf-contents").style.display = 'block' ĭocument.querySelector("#pdf-total-pages").innerHTML = _TOTAL_PAGES pdf_doc holds the handle to the PDF document normal url to a PDF or a local object url created while uploading PDF If you have a base-64 encoded data, you can convert it to a binary string through atob function. You can also pass binary data as a parameter. In case you would like to display the PDF during upload, a local url of the PDF can be generated through URL.createObjectURL() function. Cross Domain PDFs are allowed but CORS headers need to be set in the server.

Pdf_url is the url to a PDF file in your server. In simple words, PDFDocumentProxy is the handle of the current PDF file. The return value is a Promise which resolves with a PDFDocumentProxy object. This asynchonous method loads the PDF file. This object provides a number of APIs that you can call in your Javscript code.


When you include the PDF.JS script files, you get a pdfjsLib global object. Download Example Codes Download PDF.JS APIs Used in This Tutorial
