A PDF can be loaded into a Document or PDFDoc object using their respective functions to acquire the document data.
To get document data by creating a new Document object, the following example shows how to use a createDocument to retrieve document data from an external URL.
Document objects also have a getPDFDoc function for retrieving an associated PDFDoc object. However getFileData is preferred over saveMemoryBuffer in most cases because getFileData gives easy control over the output and is safer (it ensure everything is loaded and it take care of locks). The only reason to use saveMemoryBuffer over getFileData, is if there isn't an easy way of acquiring a Document object or if you need other PDFDoc features for controlling the download process.
Make sure you have Full API enabled in WebViewer.
Another way of getting document data is by using the saveMemoryBuffer function found on PDFDoc objects. An example can be found below
After acquiring a PDFDoc object, use the saveMemoryBuffer function to retrieve the document data. saveMemoryBuffer takes in an enum flag similar to getFileData flags. The flags can be found in PDFNet.SDFDoc.SaveOptions and their values are:
e_remove_unusede_hex_stringse_omit_xrefe_linearizede_compatibilityThere is also an e_incremental flag but it's ignored when using saveMemoryBuffer. saveMemoryBuffer modifies the PDFDoc data stored in memory, so it's best practice to acquire a write lock for the document.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales