new PDFDoc()
PDFDoc is a high-level class describing a single PDF (Portable Document
Format) document. Most applications using PDFNet will use this class to
open existing PDF documents, or to create new PDF documents from scratch.
The class offers a number of entry points into the document. For example,
- To access pages use pdfdoc.GetPageIterator() or pdfdoc.GetPage(page_num).
- To access form fields use pdfdoc.GetFieldIterator(), pdfdoc.GetFieldIterator(name) or pdfdoc.GetField(name).
- To access document's meta-data use pdfdoc.GetDocInfo().
- To access the outline tree use pdfdoc.GetFirstBookmark().
- To access low-level Document Catalog use pdfdoc.GetRoot().
...
The class also offers utility methods to slit and merge PDF pages,
to create new pages, to flatten forms, to change security settings, etc.
Extends
Classes
Members
-
<static> EventType
-
Type:
- number
Properties:
Name Type Description e_action_trigger_doc_will_closenumber e_action_trigger_doc_will_savenumber e_action_trigger_doc_did_savenumber e_action_trigger_doc_will_printnumber e_action_trigger_doc_did_printnumber -
<static> ExtractFlag
-
Type:
- number
Properties:
Name Type Description e_forms_onlynumber e_annots_onlynumber e_bothnumber -
<static> InsertFlag
-
Type:
- number
Properties:
Name Type Description e_nonenumber e_insert_bookmarknumber -
<static> SignaturesVerificationStatus
-
Type:
- number
Properties:
Name Type Description e_unsignednumber e_failurenumber e_untrustednumber e_unsupportednumber e_verifiednumber
Methods
-
<static> create()
-
Default constructor. Creates an empty new document.
Returns:
A promise that resolves to an object of type: "PDFNet.PDFDoc"- Type
- Promise.<PDFNet.PDFDoc>
-
<static> createDiffOptions()
-
Method to create a DiffOptions object
Returns:
A promise that resolves to a PDFNet.PDFDoc.DiffOptions.- Type
- Promise.<PDFNet.PDFDoc.DiffOptions>
-
<static> createFromBuffer(buf)
-
Open a SDF/Cos document from a memory buffer. Note: the document should be fully loaded in the memory buffer. Note: the buffer ownership is not transfered to the document so the user should clean-up any allocated memory if necessary.
Parameters:
Name Type Description bufArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray a memory buffer containing the serialized document Returns:
A promise that resolves to an object of type: "PDFNet.PDFDoc"- Type
- Promise.<PDFNet.PDFDoc>
-
<static> createFromFilePath(filepath)
-
Parameters:
Name Type Description filepathstring Returns:
A promise that resolves to an object of type: "PDFNet.PDFDoc"- Type
- Promise.<PDFNet.PDFDoc>
-
<static> createFromFilter(stream)
-
Open an existing PDF document
Parameters:
Name Type Description streamPDFNet.Filter input stream containing a serialized document. The input stream may be a random-access file, memory buffer, slow HTTP connection etc. Note: if the input stream doesn't support Seek() operation the document will load whole data stream in memory before parsing. In case of linearized PDF, the document may be parsed on-the-fly while it is being loaded in memory. Note that since MappedFile implements Seek() interface, the document does not have to be fully in memory before it is used. Note: Make sure to call InitSecurityHandler() after PDFDoc(...) for encrypted documents. Note: PDFDoc takes the ownership of the stream. Returns:
A promise that resolves to an object of type: "PDFNet.PDFDoc"- Type
- Promise.<PDFNet.PDFDoc>
-
<static> createFromLayoutEls(buf)
-
Parameters:
Name Type Description bufArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray Returns:
A promise that resolves to an object of type: "PDFNet.PDFDoc"- Type
- Promise.<PDFNet.PDFDoc>
-
<static> createFromUFilePath(filepath)
-
Open an existing PDF document
Parameters:
Name Type Description filepathstring pathname to the file. Note: Make sure to call InitSecurityHandler() after PDFDoc(...) in case a document is encrypted Returns:
A promise that resolves to an object of type: "PDFNet.PDFDoc"- Type
- Promise.<PDFNet.PDFDoc>
-
<static> createFromURL(url [, options])
-
Open a PDF document from a url. This function will fully download the file as a memory buffer and create a PDFDoc object.
Parameters:
Name Type Argument Description urlstring The url from which to download the file optionsobject <optional>
Additional options Properties
Name Type Description withCredentialsboolean Whether to set the withCredentials property on the XMLHttpRequest customHeadersobject An object containing custom HTTP headers to be used when downloading the document Returns:
A promise that resolves to an object of type: "PDFDoc".- Type
- Promise.<PDFNet.PDFDoc>
-
<static> createMergeXFDFOptions()
-
Method to create a MergeXFDFOptions object
Returns:
A promise that resolves to a PDFNet.PDFDoc.MergeXFDFOptions.- Type
- Promise.<PDFNet.PDFDoc.MergeXFDFOptions>
-
<static> createRefreshOptions()
-
Method to create a RefreshOptions object
Returns:
A promise that resolves to a PDFNet.PDFDoc.RefreshOptions.- Type
- Promise.<PDFNet.PDFDoc.RefreshOptions>
-
<static> createSnapToOptions()
-
Method to create a SnapToOptions object
Returns:
A promise that resolves to a PDFNet.PDFDoc.SnapToOptions.- Type
- Promise.<PDFNet.PDFDoc.SnapToOptions>
-
<static> createTextDiffOptions()
-
Method to create a TextDiffOptions object
Returns:
A promise that resolves to a PDFNet.PDFDoc.TextDiffOptions.- Type
- Promise.<PDFNet.PDFDoc.TextDiffOptions>
-
<static> createViewerOptimizedOptions()
-
Method to create a ViewerOptimizedOptions object
Returns:
A promise that resolves to a PDFNet.PDFDoc.ViewerOptimizedOptions.- Type
- Promise.<PDFNet.PDFDoc.ViewerOptimizedOptions>
-
<static> highlightTextDiff(doc1, doc2 [, options])
-
Imports two external PDFs and highlights the differences between them. This function directly adds the highlights to the two input documents. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit.
Parameters:
Name Type Argument Description doc1PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc is the before document, the basis of the comparison doc2PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc is the after document, to which the basis is compared optionsPDFNet.PDFDoc.TextDiffOptions <optional>
processing options (optional) Returns:
A promise that resolves to the total number of differences found- Type
- Promise.<number>
-
addFileAttachment(file_key, embedded_file)
-
Associates a file attachment with the document. The file attachment will be displayed in the user interface of a viewer application (in Acrobat this is File Attachment tab). The function differs from Annot.CreateFileAttachment() because it associates the attachment with the whole document instead of an annotation on a specific page.
Parameters:
Name Type Description file_keystring A key/name under which the attachment will be stored. embedded_filePDFNet.FileSpec Embedded file stream Note: Another way to associate a file attachment with the document is using SDF::NameTree: SDF::NameTree names = SDF::NameTree::Create(doc, "EmbeddedFiles"); names.Put(file_key, file_keysz, embedded_file.GetSDFObj());
Returns:
- Type
- Promise.<void>
-
addHighlights(hilite)
-
AddHighlights is used to highlight text in a document using 'Adobe's Highlight File Format' (Technical Note #5172 ). The method will parse the character offset data and modify the current document by adding new highlight annotations.
Parameters:
Name Type Description hilitestring a string representing the filename for the highlight file or or a data buffer containing XML data. Returns:
- Type
- Promise.<void>
-
addRootBookmark(root_bookmark)
-
Adds/links the specified Bookmark to the root level of document's outline tree.
Parameters:
Name Type Description root_bookmarkPDFNet.Bookmark Bookmark to Add/link Note: parameter 'root_bookmark' must not be linked (must not be belong) to a bookmark tree. Returns:
- Type
- Promise.<void>
-
addSignatureHandler(signature_handler)
-
Adds a signature handler to the signature manager.
Parameters:
Name Type Description signature_handlerPDFNet.SignatureHandler The signature handler instance to add to the signature manager. Returns:
A promise that resolves to a unique ID representing the SignatureHandler within the SignatureManager.- Type
- Promise.<number>
-
addStdSignatureHandlerFromBuffer(pkcs12_buffer, pkcs12_pass)
-
Parameters:
Name Type Description pkcs12_bufferArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray pkcs12_passstring Returns:
A promise that resolves to an object of type: "number"- Type
- Promise.<number>
-
addStdSignatureHandlerFromFile(pkcs12_file, pkcs12_pass)
-
Adds a standard (built-in) signature handler to the signature manager. This method will use cryptographic algorithm based on Adobe.PPKLite/adbe.pkcs7.detached filter to sign a PDF.
Parameters:
Name Type Description pkcs12_filestring The private key certificate store to use. pkcs12_passstring The passphrase for the provided private key. Returns:
A promise that resolves to a unique ID representing the SignatureHandler within the SignatureManager.- Type
- Promise.<number>
-
addStdSignatureHandlerFromURL(pkcs12_file, pkcs12_pass)
-
Adds a standard (built-in) signature handler to the signature manager. This method will use cryptographic algorithm based on Adobe.PPKLite/adbe.pkcs7.detached filter to sign a PDF.
Parameters:
Name Type Description pkcs12_filestring The private key certificate store to use. pkcs12_passstring The passphrase for the provided private key. Returns:
A promise that resolves to a unique ID representing the SignatureHandler within the SignatureManager.- Type
- Promise.<number>
-
appendTextDiffDoc(doc1, doc2 [, options])
-
Imports two external PDFs and highlights the differences between them. This function appends alternating pages from the two input documents into the current document. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit.
Parameters:
Name Type Argument Description doc1PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc is the before document, the basis of the comparison (read-only) doc2PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc is the after document, to which the basis is compared (read-only) optionsPDFNet.PDFDoc.TextDiffOptions <optional>
processing options (optional) Returns:
A promise that resolves to the total number of differences found- Type
- Promise.<number>
-
appendTextDiffPage(page1, page2)
-
Imports two external pages and highlights the differences between them. This function adds two new pages to the current document. The two input pages are typically coming from two different PDF files. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit.
Parameters:
Name Type Description page1PDFNet.Page is the before page, the basis of the comparison (read-only) page2PDFNet.Page is the after page, to which the basis is compared (read-only) Returns:
A promise that resolves to the total number of differences found- Type
- Promise.<number>
-
appendVisualDiff(p1, p2 [, opts])
-
Add a page representing the difference between two pdf pages to this document.
Parameters:
Name Type Argument Description p1PDFNet.Page one of the two pages for comparing p2PDFNet.Page the other page for comparing optsPDFNet.PDFDoc.DiffOptions <optional>
options for comparison results. This parameter is supposed to be an object, which can be generated by 'PDFNet.createDiffOptions()'. If this parameter is omitted or set to null, default settings will be used. Returns:
- Type
- Promise.<void>
-
convertToXod( [options])
-
Convert the pdf to XOD format.
Parameters:
Name Type Argument Description optionsPDFNet.Obj | PDFNet.Convert.XODOutputOptions <optional>
the conversion options - See:
-
- XODOutputOptions
- ToPdf()
Returns:
A promise that resolves to a Uint8Array containing the XOD file.- Type
- Promise.<Uint8Array>
-
convertToXodStream( [options])
-
Generate a stream that incrementally converts the pdf to XOD format.
Parameters:
Name Type Argument Description optionsPDFNet.Obj | PDFNet.Convert.XODOutputOptions <optional>
the conversion options - See:
-
- XODOutputOptions
- ToPdf()
Returns:
A filter from which the file can be read incrementally.- Type
- Promise.<PDFNet.Filter>
-
createDigitalSignatureField( [in_sig_field_name])
-
Creates an unsigned digital signature form field inside the document.
Parameters:
Name Type Argument Description in_sig_field_namestring <optional>
The fully-qualified name to give the digital signature field. If one is not provided, a unique name is created automatically. Returns:
A promise that resolves to a DigitalSignatureField object representing the created digital signature field.- Type
- Promise.<PDFNet.DigitalSignatureField>
-
createIndirectArray()
-
This method creates an SDF/Cos indirect array object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Returns:
A promise that resolves to returns a new indirect array object.- Type
- Promise.<PDFNet.Obj>
-
createIndirectBool(value)
-
This method creates an SDF/Cos indirect boolean object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Parameters:
Name Type Description valueboolean the value with which to create the boolean object. Returns:
A promise that resolves to returns a new indirect boolean object.- Type
- Promise.<PDFNet.Obj>
-
createIndirectDict()
-
This method creates an SDF/Cos indirect dict object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Returns:
A promise that resolves to returns a new indirect dict object.- Type
- Promise.<PDFNet.Obj>
-
createIndirectName(name)
-
This method creates an SDF/Cos indirect name object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Parameters:
Name Type Description namestring Returns:
A promise that resolves to an object of type: "PDFNet.Obj"- Type
- Promise.<PDFNet.Obj>
-
createIndirectNull()
-
This method creates an SDF/Cos indirect null object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Returns:
A promise that resolves to returns a new indirect null object.- Type
- Promise.<PDFNet.Obj>
-
createIndirectNumber(value)
-
This method creates an SDF/Cos indirect number object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Parameters:
Name Type Description valuenumber the value with which to create the number object. Returns:
A promise that resolves to returns a new indirect number object.- Type
- Promise.<PDFNet.Obj>
-
createIndirectStream(data, filter_chain)
-
This method creates an SDF/Cos indirect stream object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Parameters:
Name Type Description dataArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray a buffer from which to create the stream object. filter_chainPDFNet.Filter filter object with which to create the stream object. Defaults to Filters::Filter(0,false) Returns:
A promise that resolves to returns a new indirect stream object.- Type
- Promise.<PDFNet.Obj>
-
createIndirectStreamFromFilter(data [, filter_chain])
-
This method creates an SDF/Cos indirect stream object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Parameters:
Name Type Argument Description dataPDFNet.FilterReader reference to a FilterReader object with which to create the stream object. filter_chainPDFNet.Filter <optional>
filter object with which to create the stream object. Defaults to Filters::Filter(0,false) Returns:
A promise that resolves to returns a new indirect stream object.- Type
- Promise.<PDFNet.Obj>
-
createIndirectString(value, buf_size)
-
This method creates an SDF/Cos indirect string object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Parameters:
Name Type Description valuenumber Unsigned char pointer with which to create the string object. buf_sizenumber length of string. Returns:
A promise that resolves to returns a new indirect string object.- Type
- Promise.<PDFNet.Obj>
-
createIndirectStringFromUString(str)
-
This method creates an SDF/Cos indirect string object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared).
Parameters:
Name Type Description strstring reference to string with which to create the string object. Returns:
A promise that resolves to returns a new indirect string object.- Type
- Promise.<PDFNet.Obj>
-
createShallowCopy()
-
Copy Constructor
Returns:
A promise that resolves to an object of type: "PDFNet.PDFDoc"- Type
- Promise.<PDFNet.PDFDoc>
-
destroy()
-
Destructor
- Inherited From:
Returns:
- Type
- Promise.<void>
-
fdfExtract( [flag])
-
Extract form data and/or annotations to FDF
Parameters:
Name Type Argument Description flagnumber <optional>
PDFNet.PDFDoc.ExtractFlag = { e_forms_only : 0 e_annots_only : 1 e_both : 2 }specifies extract optionsReturns:
A promise that resolves to a pointer to the newly created FDF file with an interactive data.- Type
- Promise.<PDFNet.FDFDoc>
-
fdfExtractPageSet(pages_to_extract [, flag])
-
Extract form data and/or annotations to FDF
Parameters:
Name Type Argument Description pages_to_extractPDFNet.PageSet The set of pages for which to extract interactive data. flagnumber <optional>
PDFNet.PDFDoc.ExtractFlag = { e_forms_only : 0 e_annots_only : 1 e_both : 2 }specifies extract optionsReturns:
A promise that resolves to a pointer to the newly created FDF file with an interactive data.- Type
- Promise.<PDFNet.FDFDoc>
-
fdfMerge(fdf_doc)
-
Import form data from FDF file to PDF interactive form.
Parameters:
Name Type Description fdf_docPDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc a reference to the FDF file Returns:
- Type
- Promise.<void>
-
fdfUpdate(fdf_doc)
-
Replace existing form and annotation data with those imported from the FDF file. It will make annotations in the FDF match those in the PDF. Since this method avoids updating annotations unnecessarily it works well with incremental save and can sometimes preserve annotation appearances, but it requires that the annotations intended to be in the final document be in the provided FDF file. Note: Some PDF viewers (like Chrome) cannot display annotations that don't already have an appearance, so it is often desirable to call PDFDoc.RefreshAnnotAppearances after this method to ensure these annotations can still be displayed in those applications. Note: This method is not suitable for realtime collaboration.
Parameters:
Name Type Description fdf_docPDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc a pointer to the FDF file Returns:
- Type
- Promise.<void>
-
fieldCreate(field_name, type [, field_value] [, def_field_value])
-
Create a new interactive form Field.
Parameters:
Name Type Argument Description field_namestring a string representing the fully qualified name of the field (e.g. "employee.name.first"). field_name must be either a unique name or equal to an existing terminal field name. typenumber PDFNet.Field.Type = { e_button : 0 e_check : 1 e_radio : 2 e_text : 3 e_choice : 4 e_signature : 5 e_null : 6 }field type (e.g. Field::e_text, Field::e_button, etc.)field_valuePDFNet.Obj <optional>
def_field_valuePDFNet.Obj <optional>
Returns:
A promise that resolves to the new form Field.- Type
- Promise.<PDFNet.Field>
-
fieldCreateFromStrings(field_name, type, field_value [, def_field_value])
-
Create a new interactive form Field.
Parameters:
Name Type Argument Description field_namestring a string representing the fully qualified name of the field (e.g. "employee.name.first"). field_name must be either a unique name or equal to an existing terminal field name. typenumber PDFNet.Field.Type = { e_button : 0 e_check : 1 e_radio : 2 e_text : 3 e_choice : 4 e_signature : 5 e_null : 6 }field type (e.g. Field::e_text, Field::e_button, etc.)field_valuestring def_field_valuestring <optional>
Returns:
A promise that resolves to the new form Field.- Type
- Promise.<PDFNet.Field>
-
flattenAnnotations( [forms_only])
-
Flatten all annotations in the document.
Parameters:
Name Type Argument Description forms_onlyboolean <optional>
if false flatten all annotations, otherwise flatten only form fields. Returns:
- Type
- Promise.<void>
-
generateThumbnails(size)
-
Generates thumbnail images for all the pages in this PDF document.
Parameters:
Name Type Description sizenumber The maximum dimension (width or height) that thumbnails will have. Returns:
- Type
- Promise.<void>
-
getAcroForm()
-
Returns:
A promise that resolves to the AcroForm dictionary located in "/Root" or NULL if dictionary is not present.- Type
- Promise.<PDFNet.Obj>
-
getDigitalSignatureFieldIteratorBegin()
-
Retrieves an iterator that iterates over digital signature fields.
Returns:
A promise that resolves to an iterator that iterates over digital signature fields.- Type
- Promise.<PDFNet.Iterator.<PDFNet.DigitalSignatureField>>
-
getDigitalSignaturePermissions()
-
Retrieves the most restrictive document permissions locking level from all of the signed digital signatures in the document.
Returns:
A promise that resolves to an enumerated value representing the most restrictive document permission level found in the document.- Type
- Promise.<number>
Example
Return value enum: <pre> PDFNet.DigitalSignatureField.DocumentPermissions = { e_no_changes_allowed : 1 e_formfilling_signing_allowed : 2 e_annotating_formfilling_signing_allowed : 3 e_unrestricted : 4 } </pre> -
getDocInfo()
-
Returns:
A promise that resolves to the class representing document information metadata. (i.e. entries in the document information dictionary).- Type
- Promise.<PDFNet.PDFDocInfo>
-
getDownloadedByteCount()
-
Returns the number of bytes that have been downloaded, when `HasDownloader()` is True.
Returns:
A promise that resolves to the number bytes downloaded.- Type
- Promise.<number>
-
getField(field_name)
-
Parameters:
Name Type Description field_namestring a string representing the fully qualified name of the field (e.g. "employee.name.first"). Returns:
A promise that resolves to a FieldIterator referring to an interactive Field or to invalid field if the field name was not found. If a given field name was not found itr.HasNext() will return false. For example:FieldIterator itr = pdfdoc.GetFieldIterator("name"); if (itr.HasNext()) { Console.WriteLine("Field name: {0}", itr.Current().GetName()); } else { ...field was not found... }- Type
- Promise.<PDFNet.Field>
-
getFieldIterator(field_name)
-
An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A PDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document. The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms).
Parameters:
Name Type Description field_namestring String representing the name of the field to get. Returns:
A promise that resolves to an iterator to the Field in the document. For a sample, please refer to 'InteractiveForms' sample project.- Type
- Promise.<PDFNet.Iterator.<PDFNet.Field>>
-
getFieldIteratorBegin()
-
An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A PDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document. The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms).
Returns:
A promise that resolves to an iterator to the first Field in the document. The list of all Fields present in the document can be traversed as follows:FieldIterator itr = pdfdoc.GetFieldIterator(); for(; itr.HasNext(); itr.Next()) { Field field = itr.Current(); Console.WriteLine("Field name: {0}", field.GetName()); }For a sample, please refer to 'InteractiveForms' sample project.- Type
- Promise.<PDFNet.Iterator.<PDFNet.Field>>
-
getFirstBookmark()
-
Returns:
A promise that resolves to the first Bookmark from the document's outline tree. If the Bookmark tree is empty the underlying SDF/Cos Object is null and returned Bookmark is not valid (i.e. Bookmark::IsValid() returns false).- Type
- Promise.<PDFNet.Bookmark>
-
getGeometryCollectionForPage(page_num)
-
Parameters:
Name Type Description page_numnumber Returns:
A promise that resolves to an object of type: "PDFNet.GeometryCollection"- Type
- Promise.<PDFNet.GeometryCollection>
-
getGeometryCollectionForPageWithOptions(page_num [, options])
-
Create a GeometryCollection for the snapping operations.
Parameters:
Name Type Argument Description page_numnumber the page number of the pdf for snapping to. optionsPDFNet.PDFDoc.SnapToOptions <optional>
the options for snapping. Returns:
A promise that resolves to an object of type: "PDFNet.GeometryCollection"- Type
- Promise.<PDFNet.GeometryCollection>
-
getOCGConfig()
-
Returns:
A promise that resolves to the default optional-content configuration for the document from the OCProperties D entry.- Type
- Promise.<PDFNet.OCGConfig>
-
getOCGs()
-
Returns:
A promise that resolves to the Obj array that contains optional-content groups (OCGs) for the document, or NULL if the document does not contain any OCGs. The order of the groups is not guaranteed to be the creation order, and is not the same as the display order.- Type
- Promise.<PDFNet.Obj>
-
getOpenAction()
-
Returns:
A promise that resolves to action that is triggered when the document is opened. The returned action can be either a destination or some other kind of Action (see Section 8.5, 'Actions' in PDF Reference Manual). Note: if the document does not nave associated action the returned Action will be null (i.e. Action.IsValid() returns false)- Type
- Promise.<PDFNet.Action>
-
getPage(page_number)
-
Parameters:
Name Type Description page_numbernumber the page number in document's page sequence. Page numbers in document's page sequence are indexed from 1. Returns:
A promise that resolves to a Page corresponding to a given page number, or null (invalid page) if the document does not contain the given page number. For example:Page page = pdfdoc.GetPage(page_num); if (page == null) return; // Page not found
- Type
- Promise.<PDFNet.Page>
-
getPageCount()
-
Returns:
A promise that resolves to the number of pages in the document.- Type
- Promise.<number>
-
getPageIterator( [page_number])
-
Use the Next() method on the returned iterator to traverse all pages in the document. For example:
PageIterator itr = pdfdoc.GetPageIterator(); while (itr.HasNext()) { // Read every page Page page = itr.Current(); // ... itr.Next() }For full sample code, please take a look at ElementReader, PDFPageTest and PDFDraw sample projects.Parameters:
Name Type Argument Description page_numbernumber <optional>
page to set the iterator on. 1 corresponds to the first page. Returns:
A promise that resolves to an iterator to the first page in the document.- Type
- Promise.<PDFNet.Iterator.<PDFNet.Page>>
-
getPageLabel(page_num)
-
Parameters:
Name Type Description page_numnumber The page number. Because PDFNet indexes pages starting from 1, page_num must be larger than 0. Returns:
A promise that resolves to the PageLabel that is in effect for the given page. If there is no label object in effect, this method returns an invalid page label object.- Type
- Promise.<PDFNet.PageLabel>
-
getPages()
-
Returns:
A promise that resolves to A dictionary representing the root of the low level page-tree- Type
- Promise.<PDFNet.Obj>
-
getRoot()
-
Returns:
A promise that resolves to A dictionary representing the Cos root of the document (/Root entry within the trailer dictionary)- Type
- Promise.<PDFNet.Obj>
-
getSDFDoc()
-
Returns:
A promise that resolves to document's SDF/Cos document- Type
- Promise.<PDFNet.SDFDoc>
-
getSecurityHandler()
-
Returns:
A promise that resolves to currently selected SecurityHandler. Note: InitSecurityHandler() should be called before GetSecurityHandler() in order to initialize the handler. Note: Returned security handler can be modified in order to change the security settings of the existing document. Changes to the current handler will not invalidate the access to the original file and will take effect during document Save(). Note: If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method.- Type
- Promise.<PDFNet.SecurityHandler>
-
getSignatureHandler(signature_handler_id)
-
Gets the associated signature handler instance from the signature manager by looking it up with the handler name.
Parameters:
Name Type Description signature_handler_idnumber The unique id of the signature handler to get. Returns:
A promise that resolves to the signature handler instance if found, otherwise NULL.- Type
- Promise.<PDFNet.SignatureHandler>
-
getStructTree()
-
Returns:
A promise that resolves to the document's logical structure tree root.- Type
- Promise.<PDFNet.STree>
-
getTotalRemoteByteCount()
-
Returns the document's total size in bytes, when `HasDownloader()` is True.
Returns:
A promise that resolves to the total number of bytes in the remote document.- Type
- Promise.<number>
-
getTrailer()
-
Returns:
A promise that resolves to A dictionary representing the Cos root of the document (document's trailer)- Type
- Promise.<PDFNet.Obj>
-
getTriggerAction(trigger)
-
Get the Action associated with the selected Doc Trigger event.
Parameters:
Name Type Description triggernumber PDFNet.PDFDoc.EventType = { e_action_trigger_doc_will_close : 17 e_action_trigger_doc_will_save : 18 e_action_trigger_doc_did_save : 19 e_action_trigger_doc_will_print : 20 e_action_trigger_doc_did_print : 21 }the type of trigger event to getReturns:
A promise that resolves to the Action Obj if present, otherwise NULL- Type
- Promise.<PDFNet.Obj>
-
getUndoManager()
-
Returns:
A promise that resolves to the UndoManager object (one-to-one mapped to document)- Type
- Promise.<PDFNet.UndoManager>
-
getViewPrefs()
-
Returns:
A promise that resolves to viewer preferences for this document. PDFDocViewPrefs is a high-level utility class that can be used to control the way the document is to be presented on the screen or in print.- Type
- Promise.<PDFNet.PDFDocViewPrefs>
-
hasOC()
-
Returns:
A promise that resolves to true if the optional content (OC) feature is associated with the document. The document is considered to have optional content if there is an OCProperties dictionary in the document's catalog, and that dictionary has one or more entries in the OCGs array.- Type
- Promise.<boolean>
-
hasRepairedXRef()
-
Checks whether or not the underlying file has an XRef table that had to be repaired when the file was opened. If the document had an invalid XRef table when opened, PDFNet will have repaired the XRef table for its working representation of the document.
Returns:
A promise that resolves to true if document was found to be corrupted, and was repaired, during opening and has not been saved since. Note: If this function returns true, it is not possible to incrementally save the document (see http://www.pdftron.com/kb_corrupt_xref)- Type
- Promise.<boolean>
-
hasSignatures()
-
Indicates whether this documents contains any digital signatures.
Returns:
A promise that resolves to true if a digital signature is found in this PDFDoc.- Type
- Promise.<boolean>
-
importPages(page_arr [, import_bookmarks])
-
The function imports a list of pages to this document. Although a list of pages can be imported using repeated calls to PageInsert(), PageImport will not import duplicate copies of resources that are shared across pages (such as fonts, images, colorspaces etc). Therefore this method is recommended when a page import list consists of several pages that share the same resources.
Parameters:
Name Type Argument Description page_arrArray.<PDFNet.Page> A list of pages to import. All pages should belong to the same source document. import_bookmarksboolean <optional>
An optional flag specifying whether any bookmark items pointing to pages in the import list should be merged with the target (i.e. this) document. Returns:
A promise that resolves to a list of imported pages. Note that imported pages are not placed in the document page sequence. This can be done using methods such as PageInsert(), PagePushBack(), etc.- Type
- Promise.<Array.<PDFNet.Page>>
-
initSecurityHandler()
-
Initializes document's SecurityHandler. This version of InitSecurityHandler() works with Standard and Custom PDF security and can be used in situations where the password is obtained dynamically via user feedback. See EncTest sample for example code. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized it can be later obtained using GetSecurityHandler() method.
Returns:
A promise that resolves to true if the SecurityHandler was successfully initialized (this may include authentication data collection, verification etc.), false otherwise.- Type
- Promise.<boolean>
-
initStdSecurityHandler(password)
-
Initializes document's SecurityHandler using the supplied password. This version of InitSecurityHandler() assumes that document uses Standard security and that a password is specified directly. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized, it can be later obtained using GetSecurityHandler() method.
Parameters:
Name Type Description passwordstring Specifies the password used to open the document without any user feedback. Returns:
A promise that resolves to true if the given password successfully unlocked the document, false otherwise.- Type
- Promise.<boolean>
-
initStdSecurityHandlerBuffer(password_buf)
-
Initializes document's SecurityHandler using the supplied password. This version of InitSecurityHandler() assumes that document uses Standard security and that a password is specified directly. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized, it can be later obtained using GetSecurityHandler() method.
Parameters:
Name Type Description password_bufArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray Specifies the password used to open the document without any user feedback. If you would like to dynamically obtain the password, you need to derive a custom class from StdSecurityHandler() and use InitSecurityHandler() without any parameters. See EncTest sample for example code. Returns:
A promise that resolves to true if the given password successfully unlocked the document, false otherwise.- Type
- Promise.<boolean>
-
initStdSecurityHandlerUString(password)
-
Initializes document's SecurityHandler using the supplied password. This version of InitSecurityHandler() assumes that document uses Standard security and that a password is specified directly. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized, it can be later obtained using GetSecurityHandler() method.
Parameters:
Name Type Description passwordstring Specifies the password used to open the document without any user feedback. If you would like to dynamically obtain the password, you need to derive a custom class from StdSecurityHandler() and use InitSecurityHandler() without any parameters. See EncTest sample for example code. Returns:
A promise that resolves to true if the given password successfully unlocked the document, false otherwise.- Type
- Promise.<boolean>
-
insertPages(insert_before_page_number, src_doc, start_page, end_page, flag)
-
Inserts a range of pages from specified PDFDoc
Parameters:
Name Type Description insert_before_page_numbernumber the destination of the insertion. If less than or equal to 1, the pages are added to the beginning of the document. If larger than the number of pages in the destination document, the pages are appended to the document. src_docPDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc source PDFDoc to insert from start_pagenumber start of the page number to insert end_pagenumber end of the page number to insert flagnumber PDFNet.PDFDoc.InsertFlag = { e_none : 0 e_insert_bookmark : 1 }specifies insert optionsReturns:
- Type
- Promise.<void>
-
insertPageSet(insert_before_page_number, src_doc, source_page_set, flag)
-
Inserts a range of pages from specified PDFDoc using PageSet
Parameters:
Name Type Description insert_before_page_numbernumber the destination of the insertion. If less than or equal to 1, the pages are added to the beginning of the document. If larger than the number of pages in the destination document, the pages are appended to the document. src_docPDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc source PDFDoc to insert from source_page_setPDFNet.PageSet a collection of the page number to insert flagnumber PDFNet.PDFDoc.InsertFlag = { e_none : 0 e_insert_bookmark : 1 }specifies insert optionsReturns:
- Type
- Promise.<void>
-
isEncrypted()
-
Returns:
A promise that resolves to true if the document is/was originally encrypted false otherwise.- Type
- Promise.<boolean>
-
isLinearized()
-
Call this function to determine whether the document is represented in linearized (fast web view) format.
Returns:
A promise that resolves to true if document is stored in fast web view format, false otherwise. Note: any changes to the document can invalidate linearization. The function will return 'true' only if the original document is linearized and if it is not modified. In order to provide good performance over relatively slow communication links, PDFNet can generate PDF documents with linearized objects and hint tables that can allow a PDF viewer application to download and view one page of a PDF file at a time, rather than requiring the entire file (including fonts and images) to be downloaded before any of it can be viewed. To save a document in linearized (fast web view) format you only need to pass 'Doc.SaveOptions.e_linearized' flag in the Save method.- Type
- Promise.<boolean>
-
isModified()
-
Call this function to determine whether the document has been modified since it was last saved.
Returns:
A promise that resolves to true if document was modified, false otherwise- Type
- Promise.<boolean>
-
isTagged()
-
Returns:
A promise that resolves to true if this document is marked as Tagged PDF, false otherwise.- Type
- Promise.<boolean>
-
isXFA()
-
Returns:
A promise that resolves to an object of type: "boolean"- Type
- Promise.<boolean>
-
jsContextInitialize()
-
Returns:
- Type
- Promise.<void>
-
lock()
-
Locks the document to prevent competing threads from accessing the document at the same time. Threads attempting to access the document will wait in suspended state until the thread that owns the lock calls doc.Unlock().
Returns:
- Type
- Promise.<void>
-
lockRead()
-
Locks the document to prevent competing write threads (using Lock()) from accessing the document at the same time. Other reader threads however, will be allowed to access the document. Threads attempting to obtain write access to the document will wait in suspended state until the thread that owns the lock calls doc.UnlockRead(). Note: To avoid deadlocks obtaining a write lock while holding a read lock is not permitted and will throw an exception. If this situation is encountered please either unlock the read lock before the write lock is obtained or acquire a write lock (rather than read lock) in the first place.
Returns:
- Type
- Promise.<void>
-
mergeXFDF(stream [, opts])
-
Merge existing form and annotation data with those imported from the XFDF file. It will replace annotations from pdfdocument with matching annotations from XFDF. In order for the annotations to be considered matching, "name" of the xfdf annotation needs to match "NM" of that in pdf. XFDF annotations that don't have a match in the pdf document will be added. For regular xfdf files, no deletions will be made This method also supports command form of xfdf, for those files, deletions will be performed for annotations in "delete" section Since this method avoids updating annotations unnecessarily it works well with incremental save. Note: This method is suitable for realtime collaboration.
Parameters:
Name Type Argument Description streamPDFNet.Filter Input Filter which provides the xfdf contents optsPDFNet.PDFDoc.MergeXFDFOptions <optional>
MergeXFDFOptions object for finer control Throws:
PDFNetExceptionReturns:
- Type
- Promise.<void>
-
mergeXFDFString(xfdf [, opts])
-
Merge existing form and annotation data with those imported from the XFDF file. It will replace annotations from pdfdocument with matching annotations from XFDF. In order for the annotations to be considered matching, "name" of the xfdf annotation needs to match "NM" of that in pdf. XFDF annotations that don't have a match in the pdf document will be added. For regular xfdf files, no deletions will be made This method also supports command form of xfdf, for those files, deletions will be performed for annotations in "delete" section Since this method avoids updating annotations unnecessarily it works well with incremental save. Note: This method is suitable for realtime collaboration.
Parameters:
Name Type Argument Description xfdfstring xfdf contents in string form or the path to the xfdf file optsPDFNet.PDFDoc.MergeXFDFOptions <optional>
MergeXFDFOptions object for finer control Throws:
PDFNetExceptionReturns:
- Type
- Promise.<void>
-
movePages(move_before_page_number, src_doc, start_page, end_page, flag)
-
Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move.
Parameters:
Name Type Description move_before_page_numbernumber the destination of the move. If less than or equal to 1, the pages are moved to the beginning of the document. If larger than the number of pages in the destination document, the pages are moved to the end of the document. src_docPDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc source PDFDoc to move from start_pagenumber start of the page number to move end_pagenumber end of the page number to move flagnumber PDFNet.PDFDoc.InsertFlag = { e_none : 0 e_insert_bookmark : 1 }specifies insert options Note: MovePages function does not save src_doc. It merely delete pages in memeory. For permanent changes, PDFDoc::Save should be used to save src_doc after function exists.Returns:
- Type
- Promise.<void>
-
movePageSet(move_before_page_number, src_doc, source_page_set, flag)
-
Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move.
Parameters:
Name Type Description move_before_page_numbernumber the destination of the move. If less than or equal to 1, the pages are moved to the beginning of the document. If larger than the number of pages in the destination document, the pages are moved to the end of the document. src_docPDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc source PDFDoc to move from source_page_setPDFNet.PageSet a collection of the page number to move flagnumber PDFNet.PDFDoc.InsertFlag = { e_none : 0 e_insert_bookmark : 1 }specifies insert options Note: MovePages function does not save src_doc. It merely delete pages in memeory. For permanent changes, PDFDoc::Save should be used to save src_doc after function exists.Returns:
- Type
- Promise.<void>
-
pageCreate( [media_box])
-
Create a new, empty page in the document. You can use PageWriter to fill the page with new content. Finally the page should be inserted at specific place within document page sequence using PageInsert/PagePushFront/PagePushBack methods.
Parameters:
Name Type Argument Description media_boxPDFNet.Rect <optional>
A rectangle, expressed in default user space units, defining the boundaries of the physical medium on which the page is intended to be displayed or printed. A user space units is 1/72 of an inch. If media_box is not specified the default dimensions of the page are 8.5 x 11 inches (or 8.5*72, 11*72 units). The following is a listing of some standard U.S. page sizes:
- Letter = Rect(0, 0, 612, 792)
- Legal = Rect(0, 0, 612, 1008)
- Ledger = Rect(0, 0, 1224, 792)
- Tabloid = Rect(0, 0, 792, 1224)
- Executive = Rect(0, 0, 522, 756)
The following is a listing of ISO standard page sizes:
- 4A0 = Rect(0, 0, 4768, 6741)
- 2A0 = Rect(0, 0, 3370, 4768)
- A0 = Rect(0, 0, 2384, 3370)
- A1 = Rect(0, 0, 1684, 2384)
- A2 = Rect(0, 0, 1191, 1684)
- A3 = Rect(0, 0, 842, 1191)
- A4 = Rect(0, 0, 595, 842)
- A5 = Rect(0, 0, 420, 595)
- A6 = Rect(0, 0, 298, 420)
- A7 = Rect(0, 0, 210, 298)
- A8 = Rect(0, 0, 147, 210)
- A9 = Rect(0, 0, 105, 147)
- A10 = Rect(0, 0, 74, 105)
- B0 = Rect(0, 0, 2835, 4008)
- B1 = Rect(0, 0, 2004, 2835)
- B2 = Rect(0, 0, 1417, 2004)
- B3 = Rect(0, 0, 1001, 1417)
- B4 = Rect(0, 0, 709, 1001)
- B5 = Rect(0, 0, 499, 709)
- B6 = Rect(0, 0, 354, 499)
- B7 = Rect(0, 0, 249, 354)
- B8 = Rect(0, 0, 176, 249)
- B9 = Rect(0, 0, 125, 176)
- B10 = Rect(0, 0, 88, 125)
- C0 = Rect(0, 0, 2599, 3677)
- C1 = Rect(0, 0, 1837, 2599)
- C2 = Rect(0, 0, 1298, 1837)
- C3 = Rect(0, 0, 918, 1298)
- C4 = Rect(0, 0, 649, 918)
- C5 = Rect(0, 0, 459, 649)
- C6 = Rect(0, 0, 323, 459)
- C7 = Rect(0, 0, 230, 323)
- C8 = Rect(0, 0, 162, 230)
- C9 = Rect(0, 0, 113, 162)
- C10 = Rect(0, 0, 79, 113)
Returns:
A promise that resolves to a new, empty page. Note: the new page still does not belong to document page sequence and should be subsequently placed at a specific location within the sequence.- Type
- Promise.<PDFNet.Page>
-
pageInsert(where, page)
-
Insert/Import a single page at a specific location in the page sequence.
Parameters:
Name Type Description wherePDFNet.Iterator.<PDFNet.Page> The location in the page sequence indicating where to insert the page. The page is inserted before the specified location. pagePDFNet.Page A page to insert. Note: Invalidates all PageIterators pointing to the document. Returns:
- Type
- Promise.<void>
-
pagePushBack(page)
-
Adds a page to the end of a document's page sequence.
Parameters:
Name Type Description pagePDFNet.Page a page to append to the document Note: Invalidates all PageIterators pointing to the document. Returns:
- Type
- Promise.<void>
-
pagePushFront(page)
-
Adds a page to the beginning of a document's page sequence.
Parameters:
Name Type Description pagePDFNet.Page a page to prepend to the document Invalidates all PageIterators pointing to the document. Returns:
- Type
- Promise.<void>
-
pageRemove(page_itr)
-
Parameters:
Name Type Description page_itrPDFNet.Iterator.<PDFNet.Page> the PageIterator to the page that should be removed A PageIterator for the given page can be obtained using PDFDoc::GetPageIterator(page_num) or using direct iteration through document's page sequence. Returns:
- Type
- Promise.<void>
-
refreshAnnotAppearances( [options])
-
Generates the appearance stream for annotations in the document using the specified options. A common use case is to generate appearances only for missing annotations, which can be accomplished using the default options.
Parameters:
Name Type Argument Description optionsPDFNet.PDFDoc.RefreshOptions <optional>
Options that can be used to adjust this generation process. Returns:
- Type
- Promise.<void>
-
refreshFieldAppearances()
-
Regenerates the appearance stream for every widget annotation in the document Call this method if you modified field's value and would like to update field's appearances.
Returns:
- Type
- Promise.<void>
-
removePageLabel(page_num)
-
Removes the page label that is attached to the specified page, effectively merging the specified range with the previous page label sequence.
Parameters:
Name Type Description page_numnumber The page from which the page label is removed. Because PDFNet indexes pages starting from 1, page_num must be larger than 0. Returns:
- Type
- Promise.<void>
-
removeSecurity()
-
This function removes document security.
Returns:
- Type
- Promise.<void>
-
removeSignatureHandler(signature_handler_id)
-
Removes a signature handler from the signature manager.
Parameters:
Name Type Description signature_handler_idnumber The unique id of the signature handler to remove. Returns:
- Type
- Promise.<void>
-
save(path, flags)
-
Saves the document to a file. If a full save is requested to the original path, the file is saved to a file system-determined temporary file, the old file is deleted, and the temporary file is renamed to path. A full save with remove unused or linearization option may re-arrange object in the cross reference table. Therefore all pointers and references to document objects and resources should be re acquired in order to continue document editing. In order to use incremental save the specified path must match original path and e_incremental flag bit should be set.
Parameters:
Name Type Description pathstring The full path name to which the file is saved. flagsnumber A bit field composed of an OR of SDFDoc::SaveOptions values. Note: Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save. Note: If the original pdf has a corrupt xref table (see HasRepairedXref), then it can not be saved using the e_incremental flag. Returns:
- Type
- Promise.<void>
-
saveCustomSignature(in_signature, in_field, in_path)
-
Saves a custom signature Contents to a document which has been prepared to receive it. No changes should be made to document in meantime.
Parameters:
Name Type Description in_signatureArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray The signature Contents to write in_fieldPDFNet.DigitalSignatureField The signature field to which to write in_pathstring The full path name to which the file is saved. Returns:
- Type
- Promise.<void>
-
saveCustomSignatureBuffer(in_signature, in_field)
-
Saves a custom signature Contents to a document which has been prepared to receive it. No changes should be made to document in meantime.
Parameters:
Name Type Description in_signatureArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray The signature Contents to write in_fieldPDFNet.DigitalSignatureField The signature field to which to write Returns:
A promise that resolves to an object of type: "Uint8Array"- Type
- Promise.<Uint8Array>
-
saveCustomSignatureStream(in_signature, in_field)
-
Saves a custom signature Contents to a document which has been prepared to receive it. No changes should be made to document in meantime.
Parameters:
Name Type Description in_signatureArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray The signature Contents to write in_fieldPDFNet.DigitalSignatureField The signature field to which to write Returns:
A promise that resolves to an object of type: "PDFNet.Filter"- Type
- Promise.<PDFNet.Filter>
-
saveMemoryBuffer(flags)
-
Saves the document to a memory buffer.
Parameters:
Name Type Description flagsnumber A bit field composed of an OR of SDFDoc::SaveOptions values. Note that this method ignores e_incremental flag. Returns:
A promise that resolves to a Uint8Array containing file data. Note: Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save.- Type
- Promise.<Uint8Array>
-
saveStream(stream, flags)
-
Saves the document to a stream.
Parameters:
Name Type Description streamPDFNet.Filter The output stream where to write data. flagsnumber A bit field composed of an OR of the SDFDoc::SaveOptions values. Note: Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save. Note: If the original pdf has a corrupt xref table (see HasRepairedXref), then it can not be saved using the e_incremental flag. Returns:
- Type
- Promise.<void>
-
saveViewerOptimized(path, opts)
-
Applies optimizations to improve viewing speed and saves the document to the specified file. The main optimizations used are linearization and embedding thumbnails for the first page and any complex pages.
Parameters:
Name Type Description pathstring The full path name to which the file is saved. optsPDFNet.Obj | PDFNet.PDFDoc.ViewerOptimizedOptions The optimization options Returns:
- Type
- Promise.<void>
-
saveViewerOptimizedBuffer(opts)
-
Applies optimizations to improve viewing speed and saves the document to a memory buffer. The main optimizations used are linearization and embedding thumbnails for the first page and any other pages that are slow to render.
Parameters:
Name Type Description optsPDFNet.Obj | PDFNet.PDFDoc.ViewerOptimizedOptions The optimization options Returns:
A promise that resolves to an object of type: "Uint8Array"- Type
- Promise.<Uint8Array>
-
setOpenAction(action)
-
Sets the Action that will be triggered when the document is opened.
Parameters:
Name Type Description actionPDFNet.Action A new Action that will be triggered when the document is opened. An example of such action is a GoTo Action that takes the user to a given location in the document. Returns:
- Type
- Promise.<void>
-
setPageLabel(page_num, label)
-
Attaches a label to a page. This establishes the numbering scheme for that page and all following it, until another page label is encountered. This label allows PDF producers to define a page numbering system other than the default.
Parameters:
Name Type Description page_numnumber The number of the page to label. If page_num is less than 1 or greater than the number of pages in the document, the method does nothing. labelPDFNet.PageLabel Returns:
- Type
- Promise.<void>
-
setSecurityHandler(handler)
-
The function sets a new SecurityHandler as the current security handler.
Parameters:
Name Type Description handlerPDFNet.SecurityHandler new SecurityHandler Note: Setting a new security handler will not invalidate the access to the original file and will take effect during document Save(). Note: If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method. Returns:
- Type
- Promise.<void>
-
takeOwnership()
-
Take the ownership of this object, so that PDFNet.runWithCleanup won't destroy this object.
- Inherited From:
Returns:
- Type
- void
-
timedLock(milliseconds)
-
Try locking the document, waiting no longer than specified number of milliseconds.
Parameters:
Name Type Description millisecondsnumber max number of milliseconds to wait for the document to lock Returns:
A promise that resolves to true if the document is locked for multi-threaded access, false otherwise.- Type
- Promise.<boolean>
-
timedLockRead(milliseconds)
-
Tries to obtain a read lock the document for
duration, and returns true if the lock was successfully acquired Parameters:
Name Type Description millisecondsnumber duration to obtain a read lock for. Returns:
A promise that resolves to true if the document is locked for multi-threaded access, false otherwise.- Type
- Promise.<boolean>
-
tryLock()
-
Try locking the document.
Returns:
A promise that resolves to true if the document is locked for multi-threaded access, false otherwise.- Type
- Promise.<boolean>
-
tryLockRead()
-
Tries to obtain a read lock the document and returns true if the lock was successfully acquired
Returns:
A promise that resolves to true if the document is locked for multi-threaded access, false otherwise.- Type
- Promise.<boolean>
-
unlock()
-
Removes the lock from the document.
Returns:
- Type
- Promise.<void>
-
unlockRead()
-
Removes the read lock from the document.
Returns:
- Type
- Promise.<void>
-
verifySignedDigitalSignatures(opts)
-
Attempts to verify all signed cryptographic digital signatures in the document, ignoring unsigned signatures.
Parameters:
Name Type Description optsPDFNet.VerificationOptions Returns:
A promise that resolves to an enumeration value representing the state of the document's signatures- Type
- Promise.<number>
Example
Return value enum: <pre> PDFNet.PDFDoc.SignaturesVerificationStatus = { e_unsigned : 0 e_failure : 1 e_untrusted : 2 e_unsupported : 3 e_verified : 4 } </pre>