WebViewer Version: 8.11
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? No
Please give a brief summary of your issue:
When removing pages from a PDF, the PDF does not seem to decrease in size
Please describe your issue and provide steps to reproduce it:
We are using the options to manipulate a PDF (i.e. moving, adding, deleting, etc).
When adding pages, the final PDF gains in size because pages were added, but when removing those pages from the PDF, the size remains the same, so we understand that they are not being deleted.
We do the following:
Using the buttons from the Left Panel:
When a page is edited the listener for the instance.Core.DocumentViewer.Events.PAGES_UPDATED
event is triggered and we enable a custom flag to know that we need to update the PDF contents on the server side.
When saving the document we do the following:
if(save_buffer){
const PDFNet = instance.Core.PDFNet;
const doc = await documentViewer.getDocument().getPDFDoc();
const docbuf = await doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_remove_unused);
const blob = new Blob([docbuf], { type: "application/pdf" });
const data = new FormData();
data.append('file', blob, "Name goes here");
data.append('other', 'example');
// Send the form data to the server
}else{
// We save only the annotations into a separate file, no problem here
}
Any idea on why the file remains the same and the pages are actually not removed? We think the remove_unused
flag doesn’t do anything and that the pages are still in the document even though they are not visible.