Detailed description of issue
We are currently using PDF.Js as a web viewer for users to see PDF documents in self service module. As part of this, we used to download the latest stable version PDF.Js package and place it on our server and simply pass the pdf document to the viewer.html when the user wants to access the document.
Currently, we have a requirement to customize the UI(Add/Remove Print and Download buttons based on need) and also have the option for Users to Digitally Sign the document. We would like to achieve the same with minimum development effort or through configuration.
I would like to understand if by using PDF.Js express we would be able to achieve this or we would need PDFTron Web Viewer instead?
Also, I have download the PDF.Js Express package but it looked completely different from the PDF.Js package to view sample document in HTML. Please let me know on the steps to view a sample pdf in html using PDF.Js Express and also the file to be modified to enable/disable buttons(Print,Download and Signature)
Expected behaviour
N/A
Does your issue happen with every document, or just one?
N/A
PDF.js Express has a completely custom, open source UI, which is why it looks so different from PDF.js. We only use PDF.js as our core rendering engine.
It is very easy to customize our UI. For your use case of hiding certain elements, check out this guide.
This guide has instructions on integrating PDF.js Express in HTML.
PDF.js Express does support signatures out of the box, so I believe Express should be able to handle all your needs!
If you have any questions or run into issues, please let me know.
PDF.js Express uses additional resources such as WASM modules and JS chunks, which cannot be read from your local file system and instead have to be served from a web server. You will have to set up a local server and access your files that way.
I have placed the folder in our webserver and tried as suggested but I am getting the below error. Please suggest if I am missing something here. All file permissions are set to 775.
viewer.js
WebViewer({
path: “/apps/psofthr/ORQHRTST/webserv/orqhrtstt/applications/peoplesoft/PORTAL.war/orqhrtst/PDFJSExpress/lib”, // path to the PDF.js Express’lib’ folder on your server
licenseKey: ‘Insert commercial license key here after purchase’,
//initialDoc: ‘https://pdftron.s3.amazonaws.com/downloads/pl/webviewer-demo.pdf’,
initialDoc: “/apps/psofthr/ORQHRTST/webserv/orqhrtstt/applications/peoplesoft/PORTAL.war/orqhrtst/PDFJSExpress/PDF.js Express Evaluation License.pdf”, // You can also use documents on your server
}, document.getElementById(‘viewer’))
.then(instance => {
const docViewer = instance.docViewer;
const annotManager = instance.annotManager;
// call methods from instance, docViewer and annotManager as needed
// you can also access major namespaces from the instance as follows:
// const Tools = instance.Tools;
// const Annotations = instance.Annotations;
docViewer.on(‘documentLoaded’, () => {
// call methods relating to the loaded document
});
});