Class PDFNet.PDFDoc
PDFNet.PDFDoc
Constructor Attributes | Constructor Name and Description |
---|---|
PDFNet.PDFDoc(id)
PDFDoc is a high-level class describing a single PDF (Portable Document
Format) document.
|
Method Attributes | Method Name and Description |
---|---|
addFileAttachment(file_key, embedded_file)
Associates a file attachment with the document.
|
|
addHighlights(hilite)
addHighlights is used to highlight text in a document using 'Adobe's Highlight
File Format' (Technical Note #5172 ).
|
|
addRootBookmark(root_bookmark)
Adds/links the specified Bookmark to the root level of document's outline tree.
|
|
addSignatureHandler(signature_handler)
Adds a signature handler to the signature manager.
|
|
addStdSignatureHandlerFromBuffer(pkcs12_buffer, pkcs12_pass)
[Documentation Not Yet Added]
|
|
addStdSignatureHandlerFromURL(pkcs12_file, pkcs12_pass)
Adds a standard (built-in) signature handler to the signature manager.
|
|
<static> |
PDFNet.PDFDoc.create()
Default constructor.
|
<static> |
PDFNet.PDFDoc.createFromBuffer(buf)
Open a SDF/Cos document from a memory buffer.
|
<static> |
PDFNet.PDFDoc.createFromFilter(stream)
Open an existing PDF document
|
This method creates an SDF/Cos indirect array object
Unlike direct objects, indirect objects can be referenced by more than one
object (i.e.
|
|
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.
|
|
This method creates an SDF/Cos indirect dict object
Unlike direct objects, indirect objects can be referenced by more than one
object (i.e.
|
|
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.
|
|
This method creates an SDF/Cos indirect null object
Unlike direct objects, indirect objects can be referenced by more than one
object (i.e.
|
|
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.
|
|
createIndirectStream(data, data_size, 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.
|
|
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.
|
|
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.
|
|
This method creates an SDF/Cos indirect string object
Unlike direct objects, indirect objects can be referenced by more than one
object (i.e.
|
|
Copy Constructor
|
|
destroy()
Destructor
|
|
fdfExtract(flag)
Extract form data and/or annotations to FDF
|
|
fdfExtractAnnots(annot_buf)
[Documentation Not Yet Added]
|
|
fdfExtractPageSet(pages_to_extract, flag)
Extract form data and/or annotations to FDF
|
|
fdfMerge(fdf_doc)
Import form data from FDF file to PDF interactive form.
|
|
fieldCreate(field_name, type, field_value, def_field_value)
Create a new interactive form Field.
|
|
fieldCreateFromStrings(field_name, type, field_value, def_field_value)
[Documentation Not Yet Added]
|
|
flattenAnnotations(forms_only)
Flatten all annotations in the document.
|
|
flattenAnnotationsAdvanced(flags)
[Documentation Not Yet Added]
|
|
generateThumbnails(size)
Generates thumbnail images for all the pages in this PDF document.
|
|
getField(field_name)
|
|
getFieldIterator(field_name)
An interactive form (sometimes referred to as an AcroForm) is a
collection of fields for gathering information interactively from
the user.
|
|
An interactive form (sometimes referred to as an AcroForm) is a
collection of fields for gathering information interactively from
the user.
|
|
getOCGs()
|
|
getPage(page_number)
|
|
getPageIterator(page_number)
Use the Next() method on the returned iterator to traverse all pages in the document.
|
|
getPageLabel(page_num)
|
|
getPages()
|
|
getRoot()
|
|
getSignatureHandler(signature_handler_id)
Gets the associated signature handler instance from the signature manager by looking it up with the handler name.
|
|
getTriggerAction(trigger)
[Documentation Not Yet Added]
|
|
hasOC()
|
|
Indicates whether this documents contains any digital signatures.
|
|
importPages(pages, import_bookmarks)
The function imports a list of pages to this document.
|
|
initSecurityHandler(custom_data)
Initializes document's SecurityHandler.
|
|
initStdSecurityHandler(password, password_sz)
Initializes document's SecurityHandler using the supplied
password.
|
|
initStdSecurityHandlerBuffer(password_buf)
Initializes document's SecurityHandler using the supplied
password.
|
|
initStdSecurityHandlerUString(password)
Initializes document's SecurityHandler using the supplied
password.
|
|
insertPages(insert_before_page_number, src_doc, start_page, end_page, flag)
Inserts a range of pages from specified PDFDoc
|
|
insertPageSet(insert_before_page_number, src_doc, source_page_set, flag)
Inserts a range of pages from specified PDFDoc using PageSet
|
|
Call this function to determine whether the document is represented in
linearized (fast web view) format.
|
|
Call this function to determine whether the document has been modified since
it was last saved.
|
|
isTagged()
|
|
lock()
Locks the document to prevent competing threads from accessing the document
at the same time.
|
|
lockRead()
Locks the document to prevent competing write threads (using Lock()) from accessing the document
at the same time.
|
|
movePages(move_before_page_number, src_doc, start_page, end_page, flag)
Moves a range of pages from specified PDFDoc.
|
|
movePageSet(move_before_page_number, src_doc, source_page_set, flag)
Moves a range of pages from specified PDFDoc.
|
|
pageCreate(media_box)
Create a new, empty page in the document.
|
|
pageInsert(where, page)
Insert/Import a single page at a specific location in the page sequence.
|
|
pagePushBack(page)
Adds a page to the end of a document's page sequence.
|
|
pagePushFront(page)
Adds a page to the beginning of a document's page sequence.
|
|
pageRemove(page_itr)
|
|
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.
|
|
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.
|
|
This function removes document security.
|
|
removeSignatureHandler(signature_handler_id)
Removes a signature handler from the signature manager.
|
|
requirePage(page_number)
WebViewer only - Ensures that a particular page of the pdf document is finished loading
before reading or writing from it.
|
|
saveMemoryBuffer(flags)
Saves the document to a memory buffer.
|
|
saveStream(stream, flags, progress, header)
Saves the document to a stream.
|
|
setOpenAction(action)
Sets the Action that will be triggered when the document is opened.
|
|
setPageLabel(page_num, label)
attaches a label to a page.
|
|
setSecurityHandler(handler)
The function sets a new SecurityHandler as the current security handler.
|
|
timedLock(milliseconds)
Try locking the document, waiting no longer than specified number of milliseconds.
|
|
timedLockRead(milliseconds)
Tries to obtain a read lock the document for
|
|
tryLock()
Try locking the document.
|
|
Tries to obtain a read lock the document and returns true if the lock was
successfully acquired
|
|
unlock()
Removes the lock from the document.
|
|
Removes the read lock from the document.
|
Class Detail
PDFNet.PDFDoc(id)
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.PageFind(page_num).
- To access form fields use pdfdoc.GetFieldIterator() or pdfdoc.FieldFind(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.
- Parameters:
- id
Method Detail
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:
- {string} file_key
- A key/name under which the attachment will be stored.
- {FileSpec} embedded_file
- Embedded file stream
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:
- {string} hilite
- a string representing the filename for the highlight file or or a data buffer containing XML data.
addRootBookmark(root_bookmark)
Adds/links the specified Bookmark to the root level of document's outline tree.
- Parameters:
- {Bookmark} root_bookmark
- Bookmark to Add/link
{number}
addSignatureHandler(signature_handler)
Adds a signature handler to the signature manager.
- Parameters:
- {SignatureHandler} signature_handler
- The signature handler instance to add to the signature manager.
- Returns:
- {number} A promise that resolves to a unique ID representing the SignatureHandler within the SignatureManager.
{[ERROR]}
addStdSignatureHandlerFromBuffer(pkcs12_buffer, pkcs12_pass)
[Documentation Not Yet Added]
- Parameters:
- {Array} pkcs12_buffer
- (generated documentation)
- {number} pkcs12_pass
- (generated documentation)
- Returns:
- {[ERROR]} A promise that resolves to an unknown type (generated documentation)
{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:
- {string} pkcs12_file
- The private key certificate store to use.
- {string} pkcs12_pass
- The passphrase for the provided private key.
- Returns:
- {number} A promise that resolves to a unique ID representing the SignatureHandler within the SignatureManager.
<static>
{PDFDoc}
PDFNet.PDFDoc.create()
Default constructor. Creates an empty new document.
- Returns:
- {PDFDoc} A promise that resolves to an object of type: "PDFDoc" (generated documentation)
<static>
{PDFDoc}
PDFNet.PDFDoc.createFromBuffer(buf)
Open a SDF/Cos document from a memory buffer.
- Parameters:
- {Array} buf
- a memory buffer containing the serialized document
- Returns:
- {PDFDoc} A promise that resolves to an object of type: "PDFDoc" (generated documentation)
<static>
{PDFDoc}
PDFNet.PDFDoc.createFromFilter(stream)
Open an existing PDF document
- Parameters:
- {Filter} stream
- input stream containing a serialized document. The input stream may be a random-access file, memory buffer, slow HTTP connection etc.
- Returns:
- {PDFDoc} A promise that resolves to an object of type: "PDFDoc" (generated documentation)
{Obj}
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:
- {Obj} A promise that resolves to returns a new indirect array object.
{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:
- {boolean} value
- the value with which to create the boolean object.
- Returns:
- {Obj} A promise that resolves to returns a new indirect boolean object.
{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:
- {Obj} A promise that resolves to returns a new indirect dict object.
{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:
- {string} name
- (generated documentation)
- Returns:
- {Obj} A promise that resolves to an object of type: "Obj" (generated documentation)
{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:
- {Obj} A promise that resolves to returns a new indirect null object.
{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:
- {number} value
- the value with which to create the number object.
- Returns:
- {Obj} A promise that resolves to returns a new indirect number object.
{Obj}
createIndirectStream(data, data_size, 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:
- {string} data
- pointer to string with which to create the stream object.
- {number} data_size
- length of string.
- {Filter} filter_chain
- filter object with which to create the stream object. Defaults to Filters::Filter(0,false)
- Returns:
- {Obj} A promise that resolves to returns a new indirect stream object.
{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:
- {FilterReader} data
- reference to a FilterReader object with which to create the stream object.
- {Filter} filter_chain
- filter object with which to create the stream object. Defaults to Filters::Filter(0,false)
- Returns:
- {Obj} A promise that resolves to returns a new indirect stream object.
{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:
- {number} value
- Unsigned char pointer with which to create the string object.
- {number} buf_size
- length of string.
- Returns:
- {Obj} A promise that resolves to returns a new indirect string object.
{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:
- {string} str
- reference to string with which to create the string object.
- Returns:
- {Obj} A promise that resolves to returns a new indirect string object.
{PDFDoc}
createShallowCopy()
Copy Constructor
- Returns:
- {PDFDoc} A promise that resolves to an object of type: "PDFDoc" (generated documentation)
destroy()
Destructor
{FDFDoc}
fdfExtract(flag)
Extract form data and/or annotations to FDF
- Parameters:
- {number} flag
- specifies extract options
- Returns:
- {FDFDoc} A promise that resolves to a pointer to the newly created FDF file with an interactive data.
{FDFDoc}
fdfExtractAnnots(annot_buf)
[Documentation Not Yet Added]
- Parameters:
- {Array} annot_buf
- (generated documentation)
- Returns:
- {FDFDoc} A promise that resolves to an object of type: "FDFDoc" (generated documentation)
{FDFDoc}
fdfExtractPageSet(pages_to_extract, flag)
Extract form data and/or annotations to FDF
- Parameters:
- {PageSet} pages_to_extract
- The set of pages for which to extract interactive data.
- {number} flag
- specifies extract options
- Returns:
- {FDFDoc} A promise that resolves to a pointer to the newly created FDF file with an interactive data.
fdfMerge(fdf_doc)
Import form data from FDF file to PDF interactive form.
- Parameters:
- {FDFDoc} fdf_doc
- a pointer to the FDF file
{field}
fieldCreate(field_name, type, field_value, def_field_value)
Create a new interactive form Field.
- Parameters:
- {string} field_name
- 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.
- {number} type
- field type (e.g. Field::e_text, Field::e_button, etc.)
- {Obj [Y]} field_value
- {Obj [Y]} def_field_value
- Returns:
- {field} A promise that resolves to the new form Field.
{field}
fieldCreateFromStrings(field_name, type, field_value, def_field_value)
[Documentation Not Yet Added]
- Parameters:
- {string} field_name
- (generated documentation)
- {number/enum} type
- (generated enum documentation)
PDFNet.Field.Type = { e_button : 0 e_check : 1 e_radio : 2 e_text : 3 e_choice : 4 e_signature : 5 e_null : 6 }
- {string} field_value
- (generated documentation)
- {string} def_field_value
- (generated documentation)
- Returns:
- {field} A promise that resolves to an object of type: "field" (generated documentation)
flattenAnnotations(forms_only)
Flatten all annotations in the document.
- Parameters:
- {boolean} forms_only
- if false flatten all annotations, otherwise flatten only form fields.
flattenAnnotationsAdvanced(flags)
[Documentation Not Yet Added]
- Parameters:
- {number} flags
- (generated documentation)
generateThumbnails(size)
Generates thumbnail images for all the pages in this PDF document.
- Parameters:
- {number} size
- The maximum dimension (width or height) that thumbnails will have.
{Obj}
getAcroForm()
- Returns:
- {Obj} A promise that resolves to the AcroForm dictionary located in "/Root" or NULL if dictionary is not present.
{PDFDocInfo}
getDocInfo()
- Returns:
- {PDFDocInfo} A promise that resolves to the class representing document information metadata. (i.e. entries in the document information dictionary).
{field}
getField(field_name)
- Parameters:
- {string} field_name
- a string representing the fully qualified name of the field (e.g. "employee.name.first").
- Returns:
- {field} 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:
{Iterator}
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:
- {string} field_name
- String representing the name of the field to get.
- Returns:
- {Iterator} an iterator to the first Field in the document. The list of all Fields present in the document can be traversed as follows:
{Iterator}
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:
- {Iterator} 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:
{Bookmark}
getFirstBookmark()
- Returns:
- {Bookmark} 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).
{OCGConfig}
getOCGConfig()
- Returns:
- {OCGConfig} A promise that resolves to the default optional-content configuration for the document from the OCProperties D entry.
{Obj}
getOCGs()
- Returns:
- {Obj} 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.
{Action}
getOpenAction()
- Returns:
- {Action} 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).
{Page}
getPage(page_number)
- Parameters:
- {number} page_number
- the page number in document's page sequence. Page numbers in document's page sequence are indexed from 1.
- Returns:
- {Page} 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:
{number}
getPageCount()
- Returns:
- {number} A promise that resolves to the number of pages in the document.
{Iterator}
getPageIterator(page_number)
Use the Next() method on the returned iterator to traverse all pages in the document.
For example:
- Parameters:
- {number} page_number
- page to set the iterator on. 1 corresponds to the first page.
- Returns:
- {Iterator} A promise that resolves to an iterator to the first page in the document.
{pagelabel}
getPageLabel(page_num)
- Parameters:
- {number} page_num
- The page number. Because PDFNet indexes pages starting from 1, page_num must be larger than 0.
- Returns:
- {pagelabel} 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.
{Obj}
getPages()
- Returns:
- {Obj} A promise that resolves to A dictionary representing the root of the low level page-tree
{Obj}
getRoot()
- Returns:
- {Obj} A promise that resolves to A dictionary representing the Cos root of the document (/Root entry within the trailer dictionary)
{SDFDoc}
getSDFDoc()
- Returns:
- {SDFDoc} A promise that resolves to document's SDF/Cos document
{SecurityHandler}
getSecurityHandler()
- Returns:
- {SecurityHandler} A promise that resolves to currently selected SecurityHandler.
{SignatureHandler}
getSignatureHandler(signature_handler_id)
Gets the associated signature handler instance from the signature manager by looking it up with the handler name.
- Parameters:
- {number} signature_handler_id
- The unique id of the signature handler to get.
- Returns:
- {SignatureHandler} A promise that resolves to the signature handler instance if found, otherwise NULL.
{STree}
getStructTree()
- Returns:
- {STree} A promise that resolves to the document's logical structure tree root.
{Obj}
getTrailer()
- Returns:
- {Obj} A promise that resolves to A dictionary representing the Cos root of the document (document's trailer)
{Obj}
getTriggerAction(trigger)
[Documentation Not Yet Added]
- Parameters:
- {number/enum} trigger
- (generated enum documentation)
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 }
- Returns:
- {Obj} A promise that resolves to an object of type: "Obj" (generated documentation)
{PDFDocViewPrefs}
getViewPrefs()
- Returns:
- {PDFDocViewPrefs} 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.
{boolean}
hasOC()
- Returns:
- {boolean} 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.
{boolean}
hasSignatures()
Indicates whether this documents contains any digital signatures.
- Returns:
- {boolean} A promise that resolves to true if a digital signature is found in this PDFDoc.
{Page}
importPages(pages, 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:
- {Array [Y]} pages
- A list of pages to import. All pages should belong to the same source document.
- {number} import_bookmarks
- 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:
- {Page} 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.
{boolean}
initSecurityHandler(custom_data)
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.
- Parameters:
- custom_data
- Returns:
- {boolean} true if the SecurityHandler was successfully initialized (this may include authentication data collection, verification etc.), false otherwise.
{boolean}
initStdSecurityHandler(password, password_sz)
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:
- {string} password
- 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.
- {number} password_sz
- An optional parameter used to specify the size of the password buffer, in bytes. If the 'password_sz' is 0, or if the parameter is not specified, the function assumes that the string is null terminated.
- Returns:
- {boolean} A promise that resolves to true if the given password successfully unlocked the document, false otherwise.
{[ERROR]}
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:
- {Array} password_buf
- 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:
- {[ERROR]} true if the given password successfully unlocked the document, false otherwise.
{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:
- {string} password
- 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:
- {boolean} A promise that resolves to true if the given password successfully unlocked the document, false otherwise.
insertPages(insert_before_page_number, src_doc, start_page, end_page, flag)
Inserts a range of pages from specified PDFDoc
- Parameters:
- {number} insert_before_page_number
- 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.
- {PDFDoc} src_doc
- source PDFDoc to insert from
- {number} start_page
- start of the page number to insert
- {number} end_page
- end of the page number to insert
- {number} flag
- specifies insert options
insertPageSet(insert_before_page_number, src_doc, source_page_set, flag)
Inserts a range of pages from specified PDFDoc using PageSet
- Parameters:
- {number} insert_before_page_number
- 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.
- {PDFDoc} src_doc
- source PDFDoc to insert from
- {PageSet} source_page_set
- a collection of the page number to insert
- {number} flag
- specifies insert options
{boolean}
isEncrypted()
- Returns:
- {boolean} A promise that resolves to true if the document is/was originally encrypted false otherwise.
{boolean}
isLinearized()
Call this function to determine whether the document is represented in
linearized (fast web view) format.
- Returns:
- {boolean} A promise that resolves to true if document is stored in fast web view format, false otherwise.
{boolean}
isModified()
Call this function to determine whether the document has been modified since
it was last saved.
- Returns:
- {boolean} A promise that resolves to true if document was modified, false otherwise
{boolean}
isTagged()
- Returns:
- {boolean} A promise that resolves to true if this document is marked as Tagged PDF, false otherwise.
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().
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.
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:
- {number} move_before_page_number
- 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.
- {PDFDoc} src_doc
- source PDFDoc to move from
- {number} start_page
- start of the page number to move
- {number} end_page
- end of the page number to move
- {number} flag
- 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.
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:
- {number} move_before_page_number
- 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.
- {PDFDoc} src_doc
- source PDFDoc to move from
- {PageSet} source_page_set
- a collection of the page number to move
- {number} flag
- 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.
{Page}
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:
- {rect} media_box
- 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:
- {Page} A promise that resolves to a new, empty page.
pageInsert(where, page)
Insert/Import a single page at a specific location in the page sequence.
- Parameters:
- {Iterator} where
- The location in the page sequence indicating where to insert the page. The page is inserted before the specified location.
- {Page} page
- A page to insert.
pagePushBack(page)
Adds a page to the end of a document's page sequence.
- Parameters:
- {Page} page
- a page to append to the document
pagePushFront(page)
Adds a page to the beginning of a document's page sequence.
- Parameters:
- {Page} page
- a page to prepend to the document Invalidates all PageIterators pointing to the document.
pageRemove(page_itr)
- Parameters:
- {Iterator} page_itr
- the PageIterator to the page that should be removed A PageIterator for the given page can be obtained using PDFDoc::Find(page_num) or using direct iteration through document's page sequence.
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.
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:
- {number} page_num
- The page from which the page label is removed. Because PDFNet indexes pages starting from 1, page_num must be larger than 0.
removeSecurity()
This function removes document security.
removeSignatureHandler(signature_handler_id)
Removes a signature handler from the signature manager.
- Parameters:
- {number} signature_handler_id
- The unique id of the signature handler to remove.
requirePage(page_number)
WebViewer only - Ensures that a particular page of the pdf document is finished loading
before reading or writing from it. Recommended to be called before
runGeneratorWithCleanup/WithoutCleanup is called. If the page(s) to be edited cannot be known
until during the execution of the PDFNetJS script, all operations will need to be unlocked
with PDFNet.finishOperation() and [PDFDoc].unlock() before [PDFDoc].requirePage() can be called,
and relocked again with PDFNet.beginOperation() and [PDFDoc].lock()
- Parameters:
- {number} page_number
- - The page to ensure completion of.
saveMemoryBuffer(flags)
Saves the document to a memory buffer.
- Parameters:
- {number} flags
- A bit field composed of an OR of SDFDoc::SaveOptions values. Note that this method ignores e_incremental flag.
saveStream(stream, flags, progress, header)
Saves the document to a stream.
- Parameters:
- {Filter} stream
- The output stream where to write data.
- {number} flags
- A bit field composed of an OR of the SDFDoc::SaveOptions values.
- progress
- A pointer to the progress interface. NULL if progress tracking is not required.
- header
- File header. A new file header is set only during full save. See also GetHeader()
setOpenAction(action)
Sets the Action that will be triggered when the document is opened.
- Parameters:
- {Action} 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.
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:
- {number} page_num
- 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.
- {pagelabel} label
- (generated documentation)
setSecurityHandler(handler)
The function sets a new SecurityHandler as the current security handler.
- Parameters:
- {SecurityHandler} handler
- new SecurityHandler
{boolean}
timedLock(milliseconds)
Try locking the document, waiting no longer than specified number of milliseconds.
- Parameters:
- {number} milliseconds
- max number of milliseconds to wait for the document to lock
- Returns:
- {boolean} A promise that resolves to true if the document is locked for multi-threaded access, false otherwise.
{boolean}
timedLockRead(milliseconds)
Tries to obtain a read lock the document for duration, and returns
true if the lock was successfully acquired
- Parameters:
- {number} milliseconds
- duration to obtain a read lock for.
- Returns:
- {boolean} A promise that resolves to true if the document is locked for multi-threaded access, false otherwise.
{[ERROR]}
tryLock()
Try locking the document.
- Returns:
- {[ERROR]} true if the document is locked for multi-threaded access, false otherwise.
{[ERROR]}
tryLockRead()
Tries to obtain a read lock the document and returns true if the lock was
successfully acquired
- Returns:
- {[ERROR]} true if the document is locked for multi-threaded access, false otherwise.
unlock()
Removes the lock from the document.
unlockRead()
Removes the read lock from the document.