We are using WebViewer PDFNetJS to view PDF files.
While debugging "var doc = readerControl.docViewer.getDocument();", the debugger shows that the next step we're trying to have, "doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_linearized)", is undefined.
The issue is that there are two API's. First is the WebViewer API, that is available for both WebViewer.Universal and WebViewer.PDF.
For example, this is WebViewer API, and returns a WebViewer document
The second API is the PDFNetJS API, which is our PDFNet SDK API, and only available with WebViewer.PDF.
For example, here doc would be a PDF.PDFDoc
So what you want to do is the following.
var doc_buf = readerControl.docViewer.getDocument().getPDFDoc().saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_linearized);