Click or drag to resize

PDFDoc Class

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.
Stamps an image to the given destination document at the set of page numbers.
Stamps a PDF page to the given destination document at the set of page numbers.
Stamps text to the given destination document at the set of page numbers.
Deletes PDFTron stamps from document at given page numbers.
Returns true if the given set of pages has at least one stamp.
Optimize the given document using the optimizers settings
Optimize the given document using the optimizers settings
Inheritance Hierarchy
SystemObject
  pdftron.PDFPDFDoc

Namespace:  pdftron.PDF
Assembly:  pdftron (in pdftron.dll) Version: 255.255.255.255
Syntax
public sealed class PDFDoc : IClosable

Return Value

Type: 
true, if successful

The PDFDoc type exposes the following members.

Constructors
  NameDescription
Public methodPDFDoc
Creates a new empty PDF document.
Public methodPDFDoc(Byte)
Creates a new PDF document from an array of bytes.
Public methodPDFDoc(String)
Creates a new PDF document from the specified full path of the file.
Public methodPDFDoc(IStorageFile)
Creates a new PDF document from an IStorageFile instance.
Public methodPDFDoc(IBuffer)
Creates a new PDF document from a buffer.
Public methodPDFDoc(IInputStream)
Creates a new PDF document from an IInputStream instance.
Public methodPDFDoc(IRandomAccessStream)
Creates a new PDF document from an IRandomAccessStream instance.
Public methodPDFDoc(IFilter)
Creates a new PDF document from an existing IFilter instance.
Public methodPDFDoc(SDFDoc)
Creates a new PDF document from an existing SDFDoc instance.
Public methodPDFDoc(IInputStream, String)
Creates a new PDF document from an IInputStream instance.
Public methodPDFDoc(IRandomAccessStream, String)
Creates a new PDF document from an IRandomAccessStream instance.
Top
Methods
  NameDescription
Public methodAddFileAttachment
Public methodAddHighlights
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.
Public methodAddRootBookmark
Public methodAddSignatureHandler
Adds a signature handler to the signature manager.
Public methodAddStdSignatureHandler(Byte, String)
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.
Public methodAddStdSignatureHandler(String, String)
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.
Public methodAppendVisualDiff
Generates a PDF diff of the given pages by overlaying and blending them on top of each other, then appends that diff as a new page in this document.
Public methodClose
Public methodCreateIndirectArray
Creates the indirect Array.
Public methodCreateIndirectBool
Creates the indirect bool.
Public methodCreateIndirectDict
Creates the indirect dict.
Public methodCreateIndirectName
The following list of methods is used to create SDF/Cos indirect objects. Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects they can be shared).
Public methodCreateIndirectNull
Creates the indirect null.
Public methodCreateIndirectNumber
Creates the indirect number.
Public methodCreateIndirectStream(Byte)
Creates the indirect stream.
Public methodCreateIndirectStream(FilterReader)
Creates the indirect stream.
Public methodCreateIndirectStream(Byte, IFilter)
Creates the indirect stream.
Public methodCreateIndirectStream(FilterReader, IFilter)
Creates the indirect stream.
Public methodCreateIndirectString(Byte)
Creates the indirect string.
Public methodCreateIndirectString(String)
Creates the indirect string.
Public methodDestroy
Closes PDFDoc and release resources
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFDFExtract
Fdf extract.
Public methodFDFExtract(IVectorIAnnot)
Public methodFDFExtract(PDFDocExtractFlag)
Fdf extract.
Public methodFDFMerge
Import form data from FDF file to PDF interactive form.
Public methodFDFUpdate
Replace existing form and annotation data with those imported from the FDF file. Since this method avoids updating annotations unnecessarily it is ideal for incremental save.
Public methodFieldCreate(String, FieldType)
Create a new interactive form Field.
Public methodFieldCreate(String, FieldType, Obj)
Field create.
Public methodFieldCreate(String, FieldType, String)
Field create.
Public methodFieldCreate(String, FieldType, Obj, Obj)
Field create.
Public methodFieldCreate(String, FieldType, String, String)
Field create.
Public methodFlattenAnnotations
Flatten all annotations in the document.
Public methodFlattenAnnotations(Boolean)
Flatten all annotations in the document.
Public methodGenerateThumbnails
Generates thumbnail images for all the pages in this PDF document.
Public methodGetAcroForm
Gets the acro form.
Public methodGetDocInfo
Gets the doc info.
Public methodCode exampleGetField
field_name - a string representing the fully qualified name of the field (e.g. "employee.name.first").
Public methodCode exampleGetFieldIterator
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).
Public methodGetFileName
Gets the file name.
Public methodGetFirstBookmark
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetOCGConfig
Gets the OCG configuration.
Public methodGetOCGs
Gets the oC gs.
Public methodGetOpenAction
Public methodCode exampleGetPage
Gets the page.
Public methodGetPageCount
Gets the page count.
Public methodCode exampleGetPageIterator
Saves all changes to the document and writes them to an output IFilter sink without using the saved document as the new source.
Public methodGetPageIterator(Int32)
Gets the page iterator.
Public methodGetPageLabel
Gets the page label.
Public methodGetPages
Gets the pages.
Public methodGetRoot
Gets the root.
Public methodGetSDFDoc
Gets the SDFDoc.
Public methodGetSecurityHandler
Gets the security handler.
Public methodGetSignatureHandler
Gets the associated signature handler instance from the signature manager by looking it up with the provided id.
Public methodGetTrailer
Gets the trailer.
Public methodGetTriggerAction
Get the Action associated with the selected PDFDoc Trigger event
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetViewPrefs
Gets the view prefs.
Public methodHasOC
Gets the structure tree.
Public methodHasRepairedXRef
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.
Public methodHasSignatures
Indicates whether this documents contains any digital signatures.
Public methodImportPages(IVectorPage)
Public methodImportPages(IVectorPage, Boolean)
Public methodInitSecurityHandler
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.
Public methodInitSecurityHandler(Int32)
Inits the security handler.
Public methodInitStdSecurityHandler(Byte)
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.
Public methodInitStdSecurityHandler(String)
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.
Public methodInsertPages(Int32, PDFDoc, PageSet, PDFDocInsertFlag)
Inserts a range of pages from specified PDFDoc using PageSet
Public methodInsertPages(Int32, PDFDoc, Int32, Int32, PDFDocInsertFlag)
Public methodIsEncrypted
Checks if is encrypted.
Public methodIsLinearized
Call this function to determine whether the document is represented in linearized (fast web view) format.
Public methodIsLocked
Checks if is locked.
Public methodIsModified
Call this function to determine whether the document has been modified since it was last saved.
Public methodIsTagged
Checks if is tagged.
Public methodLock
Locks the document to prevent competing threads from accessiong 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().
Public methodLockRead
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().
Public methodMovePages(Int32, PDFDoc, PageSet, PDFDocInsertFlag)
Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move.
Public methodMovePages(Int32, PDFDoc, Int32, Int32, PDFDocInsertFlag)
Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move.
Public methodPageCreate
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.
Public methodPageCreate(Rect)
Page create.
Public methodPageInsert
Insert/Import a single page at a specific location in the page sequence.
Public methodPagePushBack
Adds a page to the end of a documents's page sequence.
Public methodPagePushFront
Adds a page to the beginning of a documents's page sequence.
Public methodPageRemove
Page remove.
Public methodRefreshFieldAppearances
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.
Public methodRemovePageLabel
Removes the page label that is attached to the specified page, effectively merging the specified range with the previous page label sequence.
Public methodRemoveSecurity
Removes all security for the document.
Public methodRemoveSignatureHandler
Removes a signature handler from the signature manager.
Public methodSaveAsync
Saves all changes incrementally to the document and writes them to the original source. Incremental saving is very fast, as it only appends data to the end of the file (and so is independent of the file size) This is suitable for quick save operations that you don't want to interrupt the user of the app.
Public methodSaveAsync(SDFDocSaveOptions)
Saves all changes incrementally document and writes them to the original source. Note that this might be slow, unless you are using the e_incremental flag only. Preferably shouldn't be used while the user is viewing the document. Saving with the e_incremental flag only will only append data, making the save fast no matter the original file size.
Public methodSaveAsync(String, SDFDocSaveOptions)
Saves all changes to the document and writes them to a file pointed by the given path.
Public methodSaveAsync(IStorageFile, SDFDocSaveOptions)
Saves all changes to the document and writes them to an IRandomAccessStream instance without using the saved document as the new source. Note, this will assume that randomAccessStream is pointing to a different location that the PDFDoc currently is. If this is not the case, the behavior is undefined and may corrupt the underlying document.
Public methodSaveAsync(IOutputStream, SDFDocSaveOptions)
Saves all changes to the document and writes them to an IOutputStream instance.
Public methodSaveAsync(IRandomAccessStream, SDFDocSaveOptions)
Saves all changes to the document and writes them to an IRandomAccessStream instance. Note, this save method will always create a copy of the document first, as it can no establish whether randomAccessStream is referring to the same location as the document, and so will make a copy for safety. If you know the location is different, then use SaveToNewLocationAsync.
Public methodSaveAsync(IFilter, SDFDocSaveOptions)
Saves all changes to the document and writes them to file specified by the IStorageFile instance without using the saved document as the new source. Note, this will assume that randomAccessStream is pointing to a different location that the PDFDoc currently is. If this is not the case, the behavior is undefined and may corrupt the underlying document.
Public methodSaveAsync(IRandomAccessStream, SDFDocSaveOptions, String)
Saves all changes to the document and writes them to an IRandomAccessStream instance. Note, this save method will always create a copy of the document first, as it can no establish whether randomAccessStream is referring to the same location as the document, and so will make a copy for safety. If you know the location is different, then use SaveToNewLocationAsync.
Public methodSaveToBufferAsync
Saves all changes to the document and writes them to a buffer.
Public methodSaveToNewLocationAsync(IStorageFile, SDFDocSaveOptions)
Saves all changes to the document and writes them to an IRandomAccessStream instance. Note, this will assume that storageFile is pointing to a different location that the PDFDoc currently is. If this is not the case, the behavior is undefined and may corrupt the underlying document.
Public methodSaveToNewLocationAsync(IRandomAccessStream, SDFDocSaveOptions, String)
Saves all changes to the document and writes them to an IRandomAccessStream instance. Note, this will assume that randomAccessStream is pointing to a different location that the PDFDoc currently is. If this is not the case, the behavior is undefined and may corrupt the underlying document.
Public methodSetOpenAction
Public methodSetPageLabel
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.
Public methodSetSecurityHandler
The function sets a new SecurityHandler as the current security handler.
Public methodTimedLock
Try locking the document, waiting no longer than specified number of milliseconds.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTryLock
Try locking the document in non-blocking manner.
Public methodUnlock
Removes the lock from the document.
Public methodUnlockRead
Removes the read lock from the document.
Top
See Also