Show / Hide Table of Contents

Class 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.PageFind(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.
Inheritance
System.Object
PDFDoc
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: pdftron.PDF
Assembly: PDFNet.dll
Syntax
public class PDFDoc : IDisposable

Constructors

PDFDoc()

Default constructor. Creates an empty new document.

Declaration
public PDFDoc()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PDFDoc(Filter)

Open an existing PDF document.

Declaration
public PDFDoc(Filter stream)
Parameters
Type Name Description
Filter stream
  • input stream containing a serialized document. The input stream may be a random-access file, memory buffer, slow HTTP connection etc.
Remarks

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 StdFile implements Seek() interface, the document does not have to be fully in memory before it is used. Make sure to call InitSecurityHandler() after PDFDoc(...) for encrypted documents.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PDFDoc(SDFDoc)

Create a PDF document from an existing SDF/Cos document.

Declaration
public PDFDoc(SDFDoc sdfdoc)
Parameters
Type Name Description
SDFDoc sdfdoc

a pointer to the SDF document. Created PDFDoc will take the ownership of the low-level document.

Remarks

the SDFDoc will become invalid. If you would like to access the low level document use GetSDFDoc

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PDFDoc(Byte[], Int32)

Open a SDF/Cos document from a memory buffer.

Declaration
public PDFDoc(byte[] buf, int buf_size)
Parameters
Type Name Description
System.Byte[] buf

a memory buffer containing the serialized document

System.Int32 buf_size

buffer size

Remarks

the document should be fully loaded in the memory buffer.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PDFDoc(Stream)

Open an existing PDF document.

Declaration
public PDFDoc(Stream stream)
Parameters
Type Name Description
System.IO.Stream stream
  • input stream containing a serialized document. The input stream may be a random-access file, memory buffer, slow HTTP connection etc.
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PDFDoc(String)

Open an existing PDF document.

Declaration
public PDFDoc(string filepath)
Parameters
Type Name Description
System.String filepath
  • pathname to the file.
Remarks

Make sure to call InitSecurityHandler() after PDFDoc(...) in case a document is encrypted

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Methods

AddFileAttachment(String, FileSpec)

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.

Declaration
public void AddFileAttachment(string file_key, FileSpec embeded_file)
Parameters
Type Name Description
System.String file_key

A key/name under which the attachment will be stored.

FileSpec embeded_file

the embedded_file

Examples

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());
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AddHighlights(String)

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.

Declaration
public void AddHighlights(string hilite)
Parameters
Type Name Description
System.String hilite

a string representing the filename for the highlight file or or a data buffer containing XML data.

AddRootBookmark(Bookmark)

Adds/links the specified Bookmark to the root level of document's outline tree.

Declaration
public void AddRootBookmark(Bookmark root_bookmark)
Parameters
Type Name Description
Bookmark root_bookmark

the root_bookmark

Remarks

parameter 'root_bookmark' must not be linked (must not be belong) to a bookmark tree.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AddSignatureHandler(SignatureHandler)

Adds a signature handler to the signature manager.

Declaration
public SignatureHandlerId AddSignatureHandler(SignatureHandler signature_handler)
Parameters
Type Name Description
SignatureHandler signature_handler

The signature handler instance to add to the signature manager.

Returns
Type Description
SignatureHandlerId

A unique ID representing the SignatureHandler within the SignatureManager.

AddStdSignatureHandler(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.

Declaration
public SignatureHandlerId AddStdSignatureHandler(byte[] pkcs12_keybuffer, string pkcs12_keypass)
Parameters
Type Name Description
System.Byte[] pkcs12_keybuffer

The private key certificate store to use. (As an array of bytes)

System.String pkcs12_keypass

The passphrase for the provided private key.

Returns
Type Description
SignatureHandlerId

A unique ID representing the SignatureHandler within the SignatureManager.

AddStdSignatureHandler(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.

Declaration
public SignatureHandlerId AddStdSignatureHandler(string pkcs12_keyfile, string pkcs12_keypass)
Parameters
Type Name Description
System.String pkcs12_keyfile

The private key certificate store to use.

System.String pkcs12_keypass

The passphrase for the provided private key.

Returns
Type Description
SignatureHandlerId

A unique ID representing the SignatureHandler within the SignatureManager.

AppendTextDiff(Page, Page)

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.

Declaration
public int AppendTextDiff(Page page1, Page page2)
Parameters
Type Name Description
Page page1

the before page, the basis of the comparison (read-only)

Page page2

the after page, to which the basis is compared (read-only)

Returns
Type Description
System.Int32

the total number of differences found

Remarks

This function is beta and is subject to change

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AppendTextDiff(PDFDoc, PDFDoc)

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.

Declaration
public int AppendTextDiff(PDFDoc doc1, PDFDoc doc2)
Parameters
Type Name Description
PDFDoc doc1

the before document, the basis of the comparison (read-only)

PDFDoc doc2

the after document, to which the basis is compared (read-only)

Returns
Type Description
System.Int32

the total number of differences found

Remarks

This function is beta and is subject to change

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AppendTextDiff(PDFDoc, PDFDoc, TextDiffOptions)

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.

Declaration
public int AppendTextDiff(PDFDoc doc1, PDFDoc doc2, TextDiffOptions options)
Parameters
Type Name Description
PDFDoc doc1

the before document, the basis of the comparison (read-only)

PDFDoc doc2

the after document, to which the basis is compared (read-only)

TextDiffOptions options

processing options (optional)

Returns
Type Description
System.Int32

the total number of differences found

Remarks

This function is beta and is subject to change

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AppendVisualDiff(Page, Page, DiffOptions)

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.

Declaration
public void AppendVisualDiff(Page pageA, Page pageB, DiffOptions options)
Parameters
Type Name Description
Page pageA

The first page to compare. Must be from another document.

Page pageB

The second page to compare. Must be from another document.

DiffOptions options

The options to use when comparing the page.

Close()

Closes PDFDoc and release resources

Declaration
public void Close()

CreateDigitalSignatureField()

Creates an unsigned digital signature form field inside the document with an automatically-generated unique name.

Declaration
public DigitalSignatureField CreateDigitalSignatureField()
Returns
Type Description
DigitalSignatureField

A DigitalSignatureField object representing the created digital signature field.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateDigitalSignatureField(String)

Creates an unsigned digital signature form field inside the document.

Declaration
public DigitalSignatureField CreateDigitalSignatureField(string in_sig_field_name)
Parameters
Type Name Description
System.String in_sig_field_name

The fully-qualified name to give the digital signature field. If one is not provided, a unique name is created automatically.

Returns
Type Description
DigitalSignatureField

A DigitalSignatureField object representing the created digital signature field.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectArray()

Creates the indirect array.

Declaration
public Obj CreateIndirectArray()
Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectBool(Boolean)

Creates the indirect bool.

Declaration
public Obj CreateIndirectBool(bool value)
Parameters
Type Name Description
System.Boolean value

the value

Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectDict()

Creates the indirect dict.

Declaration
public Obj CreateIndirectDict()
Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectName(String)

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).

Declaration
public Obj CreateIndirectName(string name)
Parameters
Type Name Description
System.String name

the name

Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectNull()

Creates the indirect null.

Declaration
public Obj CreateIndirectNull()
Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectNumber(Double)

Creates the indirect number.

Declaration
public Obj CreateIndirectNumber(double value)
Parameters
Type Name Description
System.Double value

the value

Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectStream(FilterReader)

Creates the indirect stream.

Declaration
public Obj CreateIndirectStream(FilterReader data)
Parameters
Type Name Description
FilterReader data

the data

Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectStream(FilterReader, Filter)

Creates the indirect stream.

Declaration
public Obj CreateIndirectStream(FilterReader data, Filter filter)
Parameters
Type Name Description
FilterReader data

the data

Filter filter

the filter_chain

Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectStream(Byte[])

Creates the indirect stream.

Declaration
public Obj CreateIndirectStream(byte[] buf)
Parameters
Type Name Description
System.Byte[] buf

the data

Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectStream(Byte[], Filter)

Creates the indirect stream.

Declaration
public Obj CreateIndirectStream(byte[] buf, Filter filter)
Parameters
Type Name Description
System.Byte[] buf

the data

Filter filter

the filter_chain

Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectString(Byte[])

Creates the indirect string.

Declaration
public Obj CreateIndirectString(byte[] buf)
Parameters
Type Name Description
System.Byte[] buf

the str

Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateIndirectString(String)

Creates the indirect string.

Declaration
public Obj CreateIndirectString(string value)
Parameters
Type Name Description
System.String value

the value

Returns
Type Description
Obj

the obj

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Dispose()

Releases all resources used by the PDFDoc

Declaration
public override sealed void Dispose()

Dispose(Boolean)

Declaration
[HandleProcessCorruptedStateExceptions]
protected virtual void Dispose(bool A_0)
Parameters
Type Name Description
System.Boolean A_0

FDFExtract()

Fdf extract.

Declaration
public FDFDoc FDFExtract()
Returns
Type Description
FDFDoc

a pointer to the newly created FDF file with an interactive data.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FDFExtract(PDFDoc.ExtractFlag)

Fdf extract.

Declaration
public FDFDoc FDFExtract(PDFDoc.ExtractFlag flag)
Parameters
Type Name Description
PDFDoc.ExtractFlag flag

the flag that specifies the extract options

Returns
Type Description
FDFDoc

a pointer to the newly created FDF file with an interactive data.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FDFExtract(ArrayList)

Extract selected annotations to FDF.

Declaration
public FDFDoc FDFExtract(ArrayList annotations)
Parameters
Type Name Description
System.Collections.ArrayList annotations

the annotation(s) to extract

Returns
Type Description
FDFDoc

the newly created FDF file with the interactive data.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FDFExtract(ArrayList, ArrayList, ArrayList)

Extract selected annotations to FDF.

Declaration
public FDFDoc FDFExtract(ArrayList added, ArrayList modified, ArrayList deleted)
Parameters
Type Name Description
System.Collections.ArrayList added
System.Collections.ArrayList modified
System.Collections.ArrayList deleted
Returns
Type Description
FDFDoc

a pointer to the newly created FDF file with an interactive data.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FDFMerge(FDFDoc)

Import form data from FDF file to PDF interactive form.

Declaration
public void FDFMerge(FDFDoc fdf_doc)
Parameters
Type Name Description
FDFDoc fdf_doc
  • a pointer to the FDF file
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FDFUpdate(FDFDoc)

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.

Declaration
public void FDFUpdate(FDFDoc fdf_doc)
Parameters
Type Name Description
FDFDoc fdf_doc
  • a pointer to the FDF file
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FieldCreate(String, Field.Type)

Create a new interactive form Field.

Declaration
public Field FieldCreate(string field_name, Field.Type type)
Parameters
Type Name Description
System.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.

Field.Type type

field type (e.g. Field::e_text, Field::e_button, etc.)

Returns
Type Description
Field

the new form Field.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FieldCreate(String, Field.Type, Obj)

Field create.

Declaration
public Field FieldCreate(string field_name, Field.Type type, Obj field_value)
Parameters
Type Name Description
System.String field_name

the field_name

Field.Type type

the type

Obj field_value

the field_value

Returns
Type Description
Field

the field

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FieldCreate(String, Field.Type, Obj, Obj)

Field create.

Declaration
public Field FieldCreate(string field_name, Field.Type type, Obj field_value, Obj def_field_value)
Parameters
Type Name Description
System.String field_name

the field_name

Field.Type type

the type

Obj field_value

the field_value

Obj def_field_value

the def_field_value

Returns
Type Description
Field

the field

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FieldCreate(String, Field.Type, String)

Field create.

Declaration
public Field FieldCreate(string field_name, Field.Type type, string field_value)
Parameters
Type Name Description
System.String field_name

the field_name

Field.Type type

the type

System.String field_value

the field_value

Returns
Type Description
Field

the field

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FieldCreate(String, Field.Type, String, String)

Field create.

Declaration
public Field FieldCreate(string field_name, Field.Type type, string field_value, string def_field_value)
Parameters
Type Name Description
System.String field_name

the field_name

Field.Type type

the type

System.String field_value

the field_value

System.String def_field_value

the def_field_value

Returns
Type Description
Field

the field

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Finalize()

Allows a PDFDoc to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

Declaration
protected void Finalize()

FlattenAnnotations()

Flatten all annotations in the document.

Declaration
public void FlattenAnnotations()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

FlattenAnnotations(Boolean)

Flatten all annotations in the document.

Declaration
public void FlattenAnnotations(bool forms_only)
Parameters
Type Name Description
System.Boolean forms_only

f false flatten all annotations, otherwise flatten only form fields.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GenerateThumbnails(UInt32)

Generates thumbnail images for all the pages in this PDF document.

Declaration
public void GenerateThumbnails(uint size)
Parameters
Type Name Description
System.UInt32 size

The maximum dimension (width or height) that thumbnails will have.

GetAcroForm()

Gets the acro form.

Declaration
public Obj GetAcroForm()
Returns
Type Description
Obj

the AcroForm dictionary located in "/Root" or NULL if dictionary is not present.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetDigitalSignatureFieldIterator()

Retrieves an iterator that iterates over digital signature fields.

Declaration
public DigitalSignatureFieldIterator GetDigitalSignatureFieldIterator()
Returns
Type Description
DigitalSignatureFieldIterator

An iterator that iterates over digital signature fields.

GetDigitalSignaturePermissions()

Retrieves the most restrictive document permissions locking level from all of the signed digital signatures in the document.

Declaration
public DigitalSignatureField.DocumentPermissions GetDigitalSignaturePermissions()
Returns
Type Description
DigitalSignatureField.DocumentPermissions

An enumerated value representing the most restrictive document permission level found in the document.

GetDocInfo()

Gets the doc info.

Declaration
public PDFDocInfo GetDocInfo()
Returns
Type Description
PDFDocInfo

The class representing document information metadata. (i.e. entries in the document information dictionary).

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetField(String)

Gets the field.

Declaration
public Field GetField(string field_name)
Parameters
Type Name Description
System.String field_name

the field_name

Returns
Type Description
Field

the field

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetFieldIterator()

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).

Declaration
public FieldIterator GetFieldIterator()
Returns
Type Description
FieldIterator

an iterator to the first Field in the document.

The list of all Fields present in the document can be traversed as follows:

Examples

For a full sample, please refer to 'InteractiveForms' sample project.

  
FieldIterator itr = pdfdoc.getFieldIterator();
for(; itr.hasNext(); itr.next()) {
Field field = itr.current();
string s = field.getName();
}
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetFieldIterator(String)

field_name - a string representing the fully qualified name of the field (e.g. "employee.name.first").

Declaration
public FieldIterator GetFieldIterator(string field_name)
Parameters
Type Name Description
System.String field_name

the field_name

Returns
Type Description
FieldIterator

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:

Examples
FieldIterator itr = pdfdoc.GetFieldIterator("name");
if (itr.hasNext()) {
string name = itr.current().getName());
}
else { ...field was not found... }
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetFileName()

Gets the file name.

Declaration
public string GetFileName()
Returns
Type Description
System.String

The filename of the document if the document is loaded from disk, or empty string if the document is not yet saved or is loaded from a memory buffer.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetFirstBookmark()

Gets the first bookmark

Declaration
public Bookmark GetFirstBookmark()
Returns
Type Description
Bookmark

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).

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetOCGConfig()

Gets the OCG configuration.

Declaration
public Config GetOCGConfig()
Returns
Type Description
Config

the default optional-content configuration for the document from the OCProperties D entry.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetOCGs()

Gets the OCGs.

Declaration
public Obj GetOCGs()
Returns
Type Description
Obj

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetOpenAction()

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).

Declaration
public Action GetOpenAction()
Returns
Type Description
Action

the open action

Remarks

if the document does not nave associated action the returned Action will be null (i.e. Action.IsValid() returns false)

GetPage(Int32)

Gets the page.

Declaration
public Page GetPage(int page_num)
Parameters
Type Name Description
System.Int32 page_num
  • the page number in document's page sequence. Page numbers in document's page sequence are indexed from 1.
Returns
Type Description
Page

a Page corresponding to a given page number, or null (invalid page) if the document does not contain the given page number.

Examples
  
Page page = pdfdoc.GetPage(page_num);
if (page == null) return; //  Page not found
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetPageCount()

Gets the page count.

Declaration
public int GetPageCount()
Returns
Type Description
System.Int32

the number of pages in the document.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetPageIterator()

Gets the page iterator.

Declaration
public PageIterator GetPageIterator()
Returns
Type Description
PageIterator

an iterator to the first page in the document. Use the Next() method on the returned iterator to traverse all pages in the document. For example:

Examples

For full sample code, please take a look at ElementReader, PDFPageTest and PDFDraw sample projects.

  
PageIterator itr = pdfdoc.getPageIterator();
while (itr.hasNext()) { //  Read every page
Page page = itr.current();
// ...
itr.next()
}
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetPageIterator(Int32)

Gets the page iterator.

Declaration
public PageIterator GetPageIterator(int page_num)
Parameters
Type Name Description
System.Int32 page_num

the page_number

Returns
Type Description
PageIterator

the page iterator

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetPageLabel(Int32)

Gets the page label.

Declaration
public PageLabel GetPageLabel(int page_num)
Parameters
Type Name Description
System.Int32 page_num

The page number. Because PDFNet indexes pages starting from 1, page_num must be larger than 0.

Returns
Type Description
PageLabel

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetPages()

Gets the pages.

Declaration
public Obj GetPages()
Returns
Type Description
Obj
  • A dictionary representing the root of the low level page-tree
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetRoot()

Gets the root.

Declaration
public Obj GetRoot()
Returns
Type Description
Obj
  • A dictionary representing the Cos root of the document (/Root entry within the trailer dictionary)
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetSDFDoc()

Gets the SDFDoc.

Declaration
public SDFDoc GetSDFDoc()
Returns
Type Description
SDFDoc

document's SDF/Cos document

GetSecurityHandler()

Gets the security handler.

Declaration
public SecurityHandler GetSecurityHandler()
Returns
Type Description
SecurityHandler

Currently selected SecurityHandler.

Remarks

InitSecurityHandler() should be called before GetSecurityHandler() in order to initialize the handler.

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().

If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method.

GetSignatureHandler(SignatureHandlerId)

Gets the associated signature handler instance from the signature manager by looking it up with the handler name.

Declaration
public SignatureHandler GetSignatureHandler(SignatureHandlerId signature_handler_id)
Parameters
Type Name Description
SignatureHandlerId signature_handler_id

The unique id of the signature handler to get.

Returns
Type Description
SignatureHandler

The signature handler instance if found, otherwise null.

GetStructTree()

Gets the structure tree.

Declaration
public STree GetStructTree()
Returns
Type Description
STree

document's logical structure tree root.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetTrailer()

Gets the trailer.

Declaration
public Obj GetTrailer()
Returns
Type Description
Obj
  • A dictionary representing the Cos root of the document (document's trailer)
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetTriggerAction(PDFDoc.EventType)

Get the Action associated with the selected PDFDoc Trigger event

Declaration
public Obj GetTriggerAction(PDFDoc.EventType trigger)
Parameters
Type Name Description
PDFDoc.EventType trigger

the type of trigger event to get

Returns
Type Description
Obj

The action Obj if present, otherwise NULL

GetUndoManager()

Declaration
public UndoManager GetUndoManager()
Returns
Type Description
UndoManager

The UndoManager object (one-to-one mapped to document)

GetViewPrefs()

Gets the view prefs.

Declaration
public PDFDocViewPrefs GetViewPrefs()
Returns
Type Description
PDFDocViewPrefs

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

HasOC()

Checks for oc.

Declaration
public bool HasOC()
Returns
Type Description
System.Boolean

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

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.

Declaration
public bool HasRepairedXRef()
Returns
Type Description
System.Boolean
  • true if document was found to be corrupted, and was repaired, during opening and has not been saved since.
Remarks

If this function returns true, it is not possible to incrementally save the document (see http://www.pdftron.com/kb_corrupt_xref)

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

HasSignatures()

Indicates whether this documents contains any digital signatures.

Declaration
public bool HasSignatures()
Returns
Type Description
System.Boolean

True if a digital signature is found in this PDFDoc.

HighlightTextDiff(PDFDoc, PDFDoc, TextDiffOptions)

Highlights the differences between the external PDFs. The highlights are added directly to the inputs. 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.

Declaration
public static int HighlightTextDiff(PDFDoc doc1, PDFDoc doc2, TextDiffOptions options)
Parameters
Type Name Description
PDFDoc doc1

the before document, the basis of the comparison

PDFDoc doc2

the after document, to which the basis is compared

TextDiffOptions options

processing options (optional)

Returns
Type Description
System.Int32

the total number of differences found

Remarks

This function is beta and is subject to change

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

ImportPages(ArrayList)

The function imports a list of pages to this documents. 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.

Declaration
public ArrayList ImportPages(ArrayList pages)
Parameters
Type Name Description
System.Collections.ArrayList pages

A list of pages to import. All pages should belong to the same source document.

Returns
Type Description
System.Collections.ArrayList

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

ImportPages(ArrayList, Boolean)

Import pages.

Declaration
public ArrayList ImportPages(ArrayList pages, bool import_bookmarks)
Parameters
Type Name Description
System.Collections.ArrayList pages

the pages

System.Boolean import_bookmarks

the import_bookmarks

Returns
Type Description
System.Collections.ArrayList

the page[]

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

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.

Declaration
public bool InitSecurityHandler()
Returns
Type Description
System.Boolean

true if the SecurityHandler was successfully initialized (this may include authentication data collection, verification etc.), false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

InitSecurityHandler(Int32)

Inits the security handler.

Declaration
public bool InitSecurityHandler(int custom_data)
Parameters
Type Name Description
System.Int32 custom_data

the custom_data

Returns
Type Description
System.Boolean

true, if successful

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

InitStdSecurityHandler(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.

Declaration
public bool InitStdSecurityHandler(byte[] passwordBuffer)
Parameters
Type Name Description
System.Byte[] passwordBuffer

Specifies the password used to open the document without any user feedback.

Returns
Type Description
System.Boolean

True if the SecurityHandler was successfully initialized.

InitStdSecurityHandler(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.

Declaration
public bool InitStdSecurityHandler(string password)
Parameters
Type Name Description
System.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
Type Description
System.Boolean

true if the given password successfully unlocked the document, false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

InsertPages(Int32, PDFDoc, PageSet, PDFDoc.InsertFlag)

Inserts a range of pages from specified PDFDoc using PageSet

Declaration
public void InsertPages(int insertBeforeThisPage, PDFDoc sourceDoc, PageSet sourcePageSet, PDFDoc.InsertFlag flag)
Parameters
Type Name Description
System.Int32 insertBeforeThisPage

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 sourceDoc

source PDFDoc to insert from

PageSet sourcePageSet

a collection of the page number to insert

PDFDoc.InsertFlag flag

specifies insert options

InsertPages(Int32, PDFDoc, Int32, Int32, PDFDoc.InsertFlag)

Inserts a range of pages from specified PDFDoc

Declaration
public void InsertPages(int insertBeforeThisPage, PDFDoc sourceDoc, int startPage, int endPage, PDFDoc.InsertFlag flag)
Parameters
Type Name Description
System.Int32 insertBeforeThisPage

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 sourceDoc

source PDFDoc to insert from

System.Int32 startPage

start of the page number to insert

System.Int32 endPage

end of the page number to insert

PDFDoc.InsertFlag flag

specifies insert options

IsEncrypted()

Checks if is encrypted.

Declaration
public bool IsEncrypted()
Returns
Type Description
System.Boolean

true if the document is/was originally encrypted false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

IsLinearized()

Call this function to determine whether the document is represented in linearized (fast web view) format.

Declaration
public bool IsLinearized()
Returns
Type Description
System.Boolean
  • true if document is stored in fast web view format, false otherwise.
Remarks

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

IsModified()

Call this function to determine whether the document has been modified since it was last saved.

Declaration
public bool IsModified()
Returns
Type Description
System.Boolean
  • true if document was modified, false otherwise
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

IsTagged()

Checks if is tagged.

Declaration
public bool IsTagged()
Returns
Type Description
System.Boolean

true if this document is marked as Tagged PDF, false otherwise.

Lock()

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().

Declaration
public void Lock()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

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.

Declaration
public void LockRead()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

MergeXFDF(Filter, MergeXFDFOptions)

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.

Declaration
public void MergeXFDF(Filter stm, MergeXFDFOptions options)
Parameters
Type Name Description
Filter stm

filter containing the content of the xfdf file

MergeXFDFOptions options

finer control parameters (see MergeXFDFOptions for more details)

MergeXFDF(String, MergeXFDFOptions)

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.

Declaration
public void MergeXFDF(string xfdf, MergeXFDFOptions options)
Parameters
Type Name Description
System.String xfdf

string containing the content of the xfdf file or the path to the xfdf file

MergeXFDFOptions options

finer control parameters (see MergeXFDFOptions for more details)

MovePages(Int32, PDFDoc, PageSet, PDFDoc.InsertFlag)

Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move.

Declaration
public void MovePages(int moveBeforeThisPage, PDFDoc sourceDoc, PageSet sourcePageSet, PDFDoc.InsertFlag flag)
Parameters
Type Name Description
System.Int32 moveBeforeThisPage

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 sourceDoc

source PDFDoc to move from

PageSet sourcePageSet

a collection of the page number to move

PDFDoc.InsertFlag flag

specifies insert options

Remarks

MovePages function does not save sourceDoc. It merely delete pages in memeory. For permanent changes, PDFDoc::Save should be used to save sourceDoc after function exists.

MovePages(Int32, PDFDoc, Int32, Int32, PDFDoc.InsertFlag)

Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move.

Declaration
public void MovePages(int moveBeforeThisPage, PDFDoc sourceDoc, int startPage, int endPage, PDFDoc.InsertFlag flag)
Parameters
Type Name Description
System.Int32 moveBeforeThisPage

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 sourceDoc

source PDFDoc to move from

System.Int32 startPage

start of the page number to move

System.Int32 endPage

end of the page number to move

PDFDoc.InsertFlag flag

specifies insert options

Remarks

MovePages function does not save sourceDoc. It merely delete pages in memeory. For permanent changes, PDFDoc::Save should be used to save sourceDoc after function exists.

PageCreate()

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.

Declaration
public Page PageCreate()
Returns
Type Description
Page

A new, empty page.

Remarks

the new page still does not belong to document page sequence and should be subsequently placed at a specific location within the sequence.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PageCreate(Rect)

Page create.

Declaration
public Page PageCreate(Rect media_box)
Parameters
Type Name Description
Rect media_box

the media_box

Returns
Type Description
Page

the page

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PageInsert(PageIterator, Page)

Insert/Import a single page at a specific location in the page sequence.

Declaration
public void PageInsert(PageIterator where, Page page)
Parameters
Type Name Description
PageIterator 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.
Remarks

Invalidates all PageIterators pointing to the document.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PagePushBack(Page)

Adds a page to the end of a documents's page sequence.

Declaration
public void PagePushBack(Page page)
Parameters
Type Name Description
Page page
  • a page to append to the document
Remarks

Invalidates all PageIterators pointing to the document.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PagePushFront(Page)

Adds a page to the beginning of a documents's page sequence.

Declaration
public void PagePushFront(Page page)
Parameters
Type Name Description
Page page
  • a page to prepend to the document Invalidates all PageIterators pointing to the document.
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PageRemove(PageIterator)

Page remove.

Declaration
public void PageRemove(PageIterator page_itr)
Parameters
Type Name Description
PageIterator 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.
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

RefreshAnnotAppearances()

Generates the appearance stream for annotations in the document using the default RefreshOptions. A common use case is to generate appearances only for missing annotations, which can be accomplished using the default options.

Declaration
public void RefreshAnnotAppearances()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

RefreshAnnotAppearances(RefreshOptions)

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.

Declaration
public void RefreshAnnotAppearances(RefreshOptions options)
Parameters
Type Name Description
RefreshOptions options

Options that can be used to adjust this generation process.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

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.

Declaration
public void RefreshFieldAppearances()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

RemovePageLabel(Int32)

Removes the page label that is attached to the specified page, effectively merging the specified range with the previous page label sequence.

Declaration
public void RemovePageLabel(int page_num)
Parameters
Type Name Description
System.Int32 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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

RemoveSecurity()

Removes all security for the document.

Declaration
public void RemoveSecurity()

RemoveSignatureHandler(SignatureHandlerId)

Removes a signature handler from the signature manager.

Declaration
public void RemoveSignatureHandler(SignatureHandlerId signature_handler_id)
Parameters
Type Name Description
SignatureHandlerId signature_handler_id

The unique id of the signature handler to remove.

Save(SDFDoc.SaveOptions)

Saves the document to a memory buffer.

Declaration
public byte[] Save(SDFDoc.SaveOptions flags)
Parameters
Type Name Description
SDFDoc.SaveOptions flags

A bit field composed of an OR of SDF.SDFDoc.SaveOptions values.

Returns
Type Description
System.Byte[]

Byte array containing the serialized version of the document

Remarks

this method ignores e_incremental flag

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Save(Stream, SDFDoc.SaveOptions)

Saves the document to a Stream.

Declaration
public void Save(Stream stm, SDFDoc.SaveOptions flags)
Parameters
Type Name Description
System.IO.Stream stm

A stream where to serialize the document.

SDFDoc.SaveOptions flags

A bit field composed of an OR of SDF.SDFDoc.SaveOptions values.

Remarks

Saving modifies the PDFDoc's internal representation. As such, the user should acquire a write lock before calling save. If the original pdf has a corrupt xref table (see HasRepairedXref or http://www.pdftron.com/kb_corrupt_xref), then it can not be saved using the e_incremental flag.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Save(String, SDFDoc.SaveOptions)

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.

Declaration
public void Save(string path, SDFDoc.SaveOptions flags)
Parameters
Type Name Description
System.String path
  • The full path name to which the file is saved.
SDFDoc.SaveOptions flags
  • A bit field composed of an OR of Doc::SaveOptions values.
Remarks

Saving modifies the PDFDoc's internal representation. As such, the user should acquire a write lock before calling save. If the original pdf has a corrupt xref table (see HasRepairedXref or http://www.pdftron.com/kb_corrupt_xref), then it can not be saved using the e_incremental flag.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SaveCustomSignature(Byte[], DigitalSignatureField, Stream)

Declaration
public void SaveCustomSignature(byte[] in_signature, DigitalSignatureField in_field, Stream out_stream)
Parameters
Type Name Description
System.Byte[] in_signature
DigitalSignatureField in_field
System.IO.Stream out_stream

SaveCustomSignature(Byte[], DigitalSignatureField, String)

Declaration
public void SaveCustomSignature(byte[] in_signature, DigitalSignatureField in_field, string in_path)
Parameters
Type Name Description
System.Byte[] in_signature
DigitalSignatureField in_field
System.String in_path

SaveViewerOptimized(ViewerOptimizedOptions)

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.

Declaration
public byte[] SaveViewerOptimized(ViewerOptimizedOptions opts)
Parameters
Type Name Description
ViewerOptimizedOptions opts

The optimization options.

Returns
Type Description
System.Byte[]

The buffer containing the serialized version of the document.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown.

SaveViewerOptimized(String, ViewerOptimizedOptions)

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.

Declaration
public void SaveViewerOptimized(string path, ViewerOptimizedOptions opts)
Parameters
Type Name Description
System.String path

The full path name to which the file is saved.

ViewerOptimizedOptions opts

The optimization options.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown.

SetOpenAction(Action)

Sets the Action that will be triggered when the document is opened.

Declaration
public void SetOpenAction(Action action)
Parameters
Type Name Description
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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SetPageLabel(Int32, PageLabel)

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.

Declaration
public void SetPageLabel(int page_num, PageLabel label)
Parameters
Type Name Description
System.Int32 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

the label

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SetSecurityHandler(SecurityHandler)

The function sets a new SecurityHandler as the current security handler.

Declaration
public void SetSecurityHandler(SecurityHandler handler)
Parameters
Type Name Description
SecurityHandler handler

the new security handler

Remarks

Setting a new security handler will not invalidate the access to the original file and will take effect during document Save().

If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method.

TimedLock(Int32)

Try locking the document, waiting no longer than specified number of milliseconds.

Declaration
public bool TimedLock(int milliseconds)
Parameters
Type Name Description
System.Int32 milliseconds

the milliseconds

Returns
Type Description
System.Boolean

true if the document is locked for multi-threaded access, false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

TimedLockRead(Int32)

Tries to obtain a read lock on the document, waiting no longer than specified number of milliseconds.

Declaration
public bool TimedLockRead(int milliseconds)
Parameters
Type Name Description
System.Int32 milliseconds

maxiumum number of milliseconds to wait for the lock

Returns
Type Description
System.Boolean

true if the document is locked for multi-threaded access, false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

TryLock()

Try locking the document in non-blocking manner.

Declaration
public bool TryLock()
Returns
Type Description
System.Boolean

true if the document is locked for multi-threaded access, false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

TryLockRead()

Tries to obtain a read lock in a non-blocking manner.

Declaration
public bool TryLockRead()
Returns
Type Description
System.Boolean

true if the document is locked for multi-threaded access, false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Unlock()

Removes the lock from the document.

Declaration
public void Unlock()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

UnlockRead()

Removes the read lock from the document.

Declaration
public void UnlockRead()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

VerifySignedDigitalSignatures(VerificationOptions)

Attempts to verify all signed cryptographic digital signatures in the document, ignoring unsigned signatures.

Declaration
public PDFDoc.SignaturesVerificationStatus VerifySignedDigitalSignatures(VerificationOptions in_opts)
Parameters
Type Name Description
VerificationOptions in_opts
Returns
Type Description
PDFDoc.SignaturesVerificationStatus

an enumeration value representing the state of the document's signatures.

Implements

System.IDisposable
Back to top Generated by DocFX