PDF.js Express Version
Detailed description of issue
I want to be able to lock the generated pdf when I save the uploaded template
Expected behavior
I want to be able to lock the generated pdf when I save the uploaded template. If i open with a pdf tool in mac os, Linux, or Adobe, I can still edit the downloaded version of pdf even if i set all the items on read-only.
Does your issue happen with every document, or just one?
This happens to all the templates I have uploaded.
Code snippet
// On Save event
const list = instance.annotManager.getAnnotationsList();
list.forEach(item => {
item.ReadOnly = true
})
instance.annotManager.setReadOnly(true);
// Get the annotations and the documents data
const xfdf = await instance.annotManager.exportAnnotations({});
const fileData = await instance.docViewer.getDocument().getFileData({});
// Set the annotations and document into the Utility SDK, then merge them together
const resp = await utils
.setFile(fileData)
.setXFDF(xfdf)
.merge();
// Get the resulting blob from the merge operation
const mergedBlob = await resp.getBlob();
// trigger a download for the user!
FileSaver.saveAs(mergedBlob, 'myfile.pdf')