#include <PDFDoc.h>
Public Types | |
enum | ActionTriggerEvent { 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 } |
enum | InsertFlag { e_none, e_insert_bookmark, e_insert_goto_bookmark } |
enum | ExtractFlag { e_forms_only, e_annots_only, e_both, e_annots_only_no_links = 5 } |
enum | SignaturesVerificationStatus { e_unsigned, e_failure, e_untrusted, e_unsupported, e_verified } |
Public Member Functions | |
PDFDoc () | |
PDFDoc (SDF::SDFDoc &sdfdoc) | |
PDFDoc (const PDFDoc &other) | |
PDFDoc & | operator= (const PDFDoc &) |
PDFDoc (const UString &filepath) | |
PDFDoc (const char *filepath) | |
PDFDoc (Filters::Filter stream) | |
PDFDoc (const UChar *buf, size_t buf_size) | |
~PDFDoc () | |
void | Close () |
bool | IsEncrypted () |
bool | InitSecurityHandler (void *custom_data=0) |
bool | InitStdSecurityHandler (const char *password, int password_sz) |
bool | InitStdSecurityHandler (const pdftron::UString &password) |
bool | InitStdSecurityHandler (const std::vector< UInt8 > &password_buf) |
SDF::SecurityHandler | GetSecurityHandler () |
void | SetSecurityHandler (const SDF::SecurityHandler &handler) |
void | RemoveSecurity () |
bool | HasSignatures () |
SDF::SignatureHandlerId | AddSignatureHandler (const SDF::SignatureHandler &signature_handler) |
SDF::SignatureHandlerId | AddStdSignatureHandler (const UString &pkcs12_keyfile, const UString &pkcs12_keypass) |
SDF::SignatureHandlerId | AddStdSignatureHandler (const std::vector< unsigned char > &pkcs12_keybuffer, const UString &pkcs12_keypass) |
void | RemoveSignatureHandler (const SDF::SignatureHandlerId signature_handler_id) |
SDF::SignatureHandler * | GetSignatureHandler (const SDF::SignatureHandlerId signature_handler_id) |
SDF::UndoManager | GetUndoManager () |
PDF::DigitalSignatureField | CreateDigitalSignatureField (const UString &in_sig_field_name="") |
PDF::DigitalSignatureFieldIterator | GetDigitalSignatureFieldIterator () |
PDF::DigitalSignatureField::DocumentPermissions | GetDigitalSignaturePermissions () const |
PDFDocInfo | GetDocInfo () |
PDFDocViewPrefs | GetViewPrefs () |
SDF::Obj | GetTriggerAction (PDFDoc::ActionTriggerEvent trigger) |
bool | IsModified () const |
bool | HasRepairedXRef () const |
bool | IsLinearized () const |
bool | HasDownloader () |
UInt64 | GetDownloadedByteCount () |
UInt64 | GetTotalRemoteByteCount () |
void | Save (const UString &path, UInt32 flags) |
void | Save (const UString &path, UInt32 flags, Common::ProgressMonitor *progress) |
std::vector< unsigned char > | Save (UInt32 flags) |
void | Save (const char *&out_buf, size_t &out_buf_size, UInt32 flags, Common::ProgressMonitor *progress) |
void | Save (Filters::Filter &stream, UInt32 flags) |
void | SaveCustomSignature (const UChar *in_signature, const size_t in_signature_size, const DigitalSignatureField &in_field, const UString &in_path) |
void | SaveCustomSignature (const UChar *in_signature, const size_t in_signature_size, const DigitalSignatureField &in_field, Filters::Filter &out_stream) |
void | SaveCustomSignature (const UChar *in_signature, const size_t in_signature_size, const DigitalSignatureField &in_field, const UChar *&out_buf, size_t &out_buf_size) |
PageIterator | GetPageIterator (UInt32 page_number=1) |
Page | GetPage (UInt32 page_number) |
void | PageRemove (const PageIterator &page_itr) |
void | PageInsert (PageIterator &where, Page page) |
void | InsertPages (int insert_before_page_number, PDFDoc &src_doc, int start_page, int end_page, enum InsertFlag flag, Common::ProgressMonitor *monitor=0) |
void | InsertPages (int insert_before_page_number, PDFDoc &src_doc, const PageSet &source_page_set, enum InsertFlag flag, Common::ProgressMonitor *monitor=0) |
void | MovePages (int move_before_page_number, PDFDoc &src_doc, int start_page, int end_page, enum InsertFlag flag, Common::ProgressMonitor *monitor=0) |
void | MovePages (int move_before_page_number, PDFDoc &src_doc, const PageSet &source_page_set, enum InsertFlag flag, Common::ProgressMonitor *monitor=0) |
void | PagePushFront (Page page) |
void | PagePushBack (Page page) |
std::vector< Page > | ImportPages (const std::vector< Page > &pages, bool import_bookmarks=false) |
Page | PageCreate (const Rect &media_box=Rect(0, 0, 612, 792)) |
int | AppendTextDiff (Page page1, Page page2) |
int | AppendTextDiff (PDFDoc &doc1, PDFDoc &doc2) |
int | AppendTextDiff (PDFDoc &doc1, PDFDoc &doc2, TextDiffOptions *options) |
class Bookmark | GetFirstBookmark () |
void | AddRootBookmark (class Bookmark root_bookmark) |
SDF::Obj | GetTrailer () |
SDF::Obj | GetRoot () |
SDF::Obj | GetPages () |
int | GetPageCount () |
FieldIterator | GetFieldIterator () |
FieldIterator | GetFieldIterator (const UString &field_name) |
Field | GetField (const UString &field_name) |
Field | FieldCreate (const UString &field_name, Field::Type type, SDF::Obj field_value=0, SDF::Obj def_field_value=0) |
Field | FieldCreate (const UString &field_name, Field::Type type, const UString &field_value, const UString &def_field_value="") |
void | RefreshFieldAppearances () |
void | RefreshAnnotAppearances (const RefreshOptions *options=0) |
void | FlattenAnnotations (bool forms_only=false) |
SDF::Obj | GetAcroForm () |
FDF::FDFDoc | FDFExtract (enum ExtractFlag flag=e_forms_only) |
FDF::FDFDoc | FDFExtract (PageSet &pages_to_extract, enum ExtractFlag flag=e_forms_only) |
FDF::FDFDoc | FDFExtract (const std::vector< Annot > &annotations) |
FDF::FDFDoc | FDFExtract (const std::vector< Annot > &annot_added, const std::vector< Annot > &annot_modified, const std::vector< Annot > &annot_deleted) |
void | FDFMerge (FDF::FDFDoc &fdf_doc) |
void | FDFUpdate (FDF::FDFDoc &fdf_doc) |
Action | GetOpenAction () |
void | SetOpenAction (const Action &action) |
void | AddFileAttachment (const UString &file_key, FileSpec embedded_file) |
PageLabel | GetPageLabel (int page_num) |
void | SetPageLabel (int page_num, PageLabel &label) |
void | RemovePageLabel (int page_num) |
bool | IsTagged () |
Struct::STree | GetStructTree () |
bool | HasOC () const |
SDF::Obj | GetOCGs () const |
OCG::Config | GetOCGConfig () const |
void | AddHighlights (const UString &hilite) |
SDF::Obj | CreateIndirectName (const char *name) |
SDF::Obj | CreateIndirectArray () |
SDF::Obj | CreateIndirectBool (bool value) |
SDF::Obj | CreateIndirectDict () |
SDF::Obj | CreateIndirectNull () |
SDF::Obj | CreateIndirectNumber (double value) |
SDF::Obj | CreateIndirectString (const UChar *value, UInt32 size) |
SDF::Obj | CreateIndirectString (const UString &str) |
SDF::Obj | CreateIndirectStream (Filters::FilterReader &data, Filters::Filter filter_chain=Filters::Filter(0, false)) |
SDF::Obj | CreateIndirectStream (const char *data, const size_t data_size, Filters::Filter filter_chain=Filters::Filter(0, false)) |
SDF::SDFDoc & | GetSDFDoc () |
operator SDF::SDFDoc & () | |
void | Lock () |
void | Unlock () |
bool | TryLock (int milliseconds=0) |
void | LockRead () |
void | UnlockRead () |
bool | TryLockRead (int milliseconds=0) |
UString | GetFileName () const |
void | GenerateThumbnails (UInt32 size) |
void | AppendVisualDiff (Page p1, Page p2, DiffOptions *opts) |
void | SaveViewerOptimized (const UString &path, const ViewerOptimizedOptions &opts) |
void | SaveViewerOptimized (const char *&out_buf, size_t &out_buf_size, const ViewerOptimizedOptions &opts) |
std::vector< unsigned char > | SaveViewerOptimized (const ViewerOptimizedOptions &opts) |
SignaturesVerificationStatus | VerifySignedDigitalSignatures (const VerificationOptions &in_opts) const |
void | MergeXFDF (Filters::Filter stream, const MergeXFDFOptions *opts=0) |
void | MergeXFDF (const UString &xfdf, const MergeXFDFOptions *opts=0) |
ptrdiff_t | GetHandleInternal () |
Static Public Member Functions | |
static int | HighlightTextDiff (PDFDoc &doc1, PDFDoc &doc2, TextDiffOptions *options) |
static PDFDoc * | CreateInternal (ptrdiff_t impl) |
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,
The class also offers utility methods to slit and merge PDF pages, to create new pages, to flatten forms, to change security settings, etc.
pdftron::PDF::PDFDoc::PDFDoc | ( | ) |
Default constructor. Creates an empty new document.
pdftron::PDF::PDFDoc::PDFDoc | ( | SDF::SDFDoc & | sdfdoc | ) |
pdftron::PDF::PDFDoc::PDFDoc | ( | const PDFDoc & | other | ) |
pdftron::PDF::PDFDoc::PDFDoc | ( | const UString & | filepath | ) |
Open an existing PDF document
filepath | - pathname to the file. |
pdftron::PDF::PDFDoc::PDFDoc | ( | const char * | filepath | ) |
pdftron::PDF::PDFDoc::PDFDoc | ( | Filters::Filter | stream | ) |
Open an existing PDF document
stream | - input stream containing a serialized document. The input stream may be a random-access file, memory buffer, slow HTTP connection etc. |
pdftron::PDF::PDFDoc::PDFDoc | ( | const UChar * | buf, |
size_t | buf_size | ||
) |
Open a SDF/Cos document from a memory buffer.
buf | - a memory buffer containing the serialized document |
buf_size | - the size of memory buffer. |
pdftron::PDF::PDFDoc::~PDFDoc | ( | ) |
Destructor
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.
file_key | A key/name under which the attachment will be stored. |
embedded_file | Embedded file stream |
void pdftron::PDF::PDFDoc::AddHighlights | ( | const UString & | 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.
hilite | a string representing the filename for the highlight file or or a data buffer containing XML data. |
An | exception will be thrown if the XML file is malformed or os out of sync with the document. |
void pdftron::PDF::PDFDoc::AddRootBookmark | ( | class Bookmark | root_bookmark | ) |
SDF::SignatureHandlerId pdftron::PDF::PDFDoc::AddSignatureHandler | ( | const SDF::SignatureHandler & | signature_handler | ) |
Adds a signature handler to the signature manager.
signature_handler | The signature handler instance to add to the signature manager. |
SDF::SignatureHandlerId pdftron::PDF::PDFDoc::AddStdSignatureHandler | ( | const UString & | pkcs12_keyfile, |
const UString & | pkcs12_keypass | ||
) |
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.
pkcs12_file | The private key certificate store to use. |
pkcs12_pass | The passphrase for the provided private key. |
SDF::SignatureHandlerId pdftron::PDF::PDFDoc::AddStdSignatureHandler | ( | const std::vector< unsigned char > & | pkcs12_keybuffer, |
const UString & | pkcs12_keypass | ||
) |
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.
pkcs12_keybuffer | The private key certificate store to use (as a data buffer in an array of bytes). |
pkcs12_pass | The passphrase for the provided private key. |
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.
page1 | is the before page, the basis of the comparison (read-only) |
page2 | is the after page, to which the basis is compared (read-only) |
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.
doc1 | is the before document, the basis of the comparison (read-only) |
doc2 | is the after document, to which the basis is compared (read-only) |
int pdftron::PDF::PDFDoc::AppendTextDiff | ( | PDFDoc & | doc1, |
PDFDoc & | doc2, | ||
TextDiffOptions * | options | ||
) |
Imports two external PDFs and highlights the differences between them. This function appends alternating pages from the two input documents into the current document. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit.
doc1 | is the before document, the basis of the comparison (read-only) |
doc2 | is the after document, to which the basis is compared (read-only) |
options | processing options (optional) |
void pdftron::PDF::PDFDoc::AppendVisualDiff | ( | Page | p1, |
Page | p2, | ||
DiffOptions * | opts | ||
) |
Generates a PDF diff of the given pages by overlaying and blending them on top of each other.
p1 | one of the two pages for comparing. |
p2 | the other page for comparing. |
opts | options for comparison results. |
void pdftron::PDF::PDFDoc::Close | ( | ) |
Close PDFDoc
PDF::DigitalSignatureField pdftron::PDF::PDFDoc::CreateDigitalSignatureField | ( | const UString & | in_sig_field_name = "" | ) |
Creates an unsigned digital signature form field inside the document.
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. |
SDF::Obj pdftron::PDF::PDFDoc::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).
SDF::Obj pdftron::PDF::PDFDoc::CreateIndirectBool | ( | bool | 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).
value | the value with which to create the boolean object. |
SDF::Obj pdftron::PDF::PDFDoc::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).
SDF::Obj pdftron::PDF::PDFDoc::CreateIndirectName | ( | const char * | 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).
SDF::Obj pdftron::PDF::PDFDoc::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).
SDF::Obj pdftron::PDF::PDFDoc::CreateIndirectNumber | ( | double | 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).
value | the value with which to create the number object. |
SDF::Obj pdftron::PDF::PDFDoc::CreateIndirectStream | ( | Filters::FilterReader & | data, |
Filters::Filter | filter_chain = Filters::Filter(0, false) |
||
) |
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).
data | reference to a FilterReader object with which to create the stream object. |
filter_chain | filter object with which to create the stream object. Defaults to Filters::Filter(0,false) |
SDF::Obj pdftron::PDF::PDFDoc::CreateIndirectStream | ( | const char * | data, |
const size_t | data_size, | ||
Filters::Filter | filter_chain = Filters::Filter(0, false) |
||
) |
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).
data | a buffer from which to create the stream object. |
data_size | size of the buffer. |
filter_chain | filter object with which to create the stream object. Defaults to Filters::Filter(0,false) |
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).
value | Unsigned char pointer with which to create the string object. |
size | length of string. |
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).
str | reference to string with which to create the string object. |
|
static |
FDF::FDFDoc pdftron::PDF::PDFDoc::FDFExtract | ( | enum ExtractFlag | flag = e_forms_only | ) |
FDF::FDFDoc pdftron::PDF::PDFDoc::FDFExtract | ( | PageSet & | pages_to_extract, |
enum ExtractFlag | flag = e_forms_only |
||
) |
FDF::FDFDoc pdftron::PDF::PDFDoc::FDFExtract | ( | const std::vector< Annot > & | annotations | ) |
FDF::FDFDoc pdftron::PDF::PDFDoc::FDFExtract | ( | const std::vector< Annot > & | annot_added, |
const std::vector< Annot > & | annot_modified, | ||
const std::vector< Annot > & | annot_deleted | ||
) |
void pdftron::PDF::PDFDoc::FDFMerge | ( | FDF::FDFDoc & | fdf_doc | ) |
void pdftron::PDF::PDFDoc::FDFUpdate | ( | FDF::FDFDoc & | fdf_doc | ) |
Replace existing form and annotation data with those imported from the FDF file. It will make annotations in the FDF match those in the PDF. Since this method avoids updating annotations unnecessarily it works well with incremental save and can sometimes preserve annotation appearances, but it requires that the annotations intended to be in the final document be in the provided FDF file.
fdf_doc | a pointer to the FDF file |
Field pdftron::PDF::PDFDoc::FieldCreate | ( | const UString & | field_name, |
Field::Type | type, | ||
SDF::Obj | field_value = 0 , |
||
SDF::Obj | def_field_value = 0 |
||
) |
Create a new interactive form Field.
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. |
type | field type (e.g. Field::e_text, Field::e_button, etc.) |
field_value | |
def_field_value |
if | 'field_name' is equal to an existing non-terminal field name an exception is thrown. |
Field pdftron::PDF::PDFDoc::FieldCreate | ( | const UString & | field_name, |
Field::Type | type, | ||
const UString & | field_value, | ||
const UString & | def_field_value = "" |
||
) |
Create a new interactive form Field.
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. |
type | field type (e.g. Field::e_text, Field::e_button, etc.) |
field_value | |
def_field_value |
if | 'field_name' is equal to an existing non-terminal field name an exception is thrown. |
void pdftron::PDF::PDFDoc::FlattenAnnotations | ( | bool | forms_only = false | ) |
Flatten all annotations in the document.
forms_only | if false flatten all annotations, otherwise flatten only form fields. |
void pdftron::PDF::PDFDoc::GenerateThumbnails | ( | UInt32 | size | ) |
Generates thumbnail images for all the pages in this PDF document.
size | The maximum dimension (width or height) that thumbnails will have. |
SDF::Obj pdftron::PDF::PDFDoc::GetAcroForm | ( | ) |
PDF::DigitalSignatureFieldIterator pdftron::PDF::PDFDoc::GetDigitalSignatureFieldIterator | ( | ) |
Retrieves an iterator that iterates over digital signature fields.
PDF::DigitalSignatureField::DocumentPermissions pdftron::PDF::PDFDoc::GetDigitalSignaturePermissions | ( | ) | const |
Retrieves the most restrictive document permissions locking level from all of the signed digital signatures in the document.
PDFDocInfo pdftron::PDF::PDFDoc::GetDocInfo | ( | ) |
UInt64 pdftron::PDF::PDFDoc::GetDownloadedByteCount | ( | ) |
Returns the number of bytes that have been downloaded, when HasDownloader()
is True.
if | 'HasDownloader()` returns False, calling this method will result in an exception. |
field_name | - a string representing the fully qualified name of the field (e.g. "employee.name.first"). |
FieldIterator pdftron::PDF::PDFDoc::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).
The list of all Fields present in the document can be traversed as follows:
For a sample, please refer to 'InteractiveForms' sample project.
FieldIterator pdftron::PDF::PDFDoc::GetFieldIterator | ( | const UString & | 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).
field_name | String representing the name of the field to get. |
For a sample, please refer to 'InteractiveForms' sample project.
UString pdftron::PDF::PDFDoc::GetFileName | ( | ) | const |
class Bookmark pdftron::PDF::PDFDoc::GetFirstBookmark | ( | ) |
ptrdiff_t pdftron::PDF::PDFDoc::GetHandleInternal | ( | ) |
OCG::Config pdftron::PDF::PDFDoc::GetOCGConfig | ( | ) | const |
SDF::Obj pdftron::PDF::PDFDoc::GetOCGs | ( | ) | const |
Action pdftron::PDF::PDFDoc::GetOpenAction | ( | ) |
page_number | - the page number in document's page sequence. Page numbers in document's page sequence are indexed from 1. |
For example:
int pdftron::PDF::PDFDoc::GetPageCount | ( | ) |
PageIterator pdftron::PDF::PDFDoc::GetPageIterator | ( | UInt32 | page_number = 1 | ) |
Use the Next() method on the returned iterator to traverse all pages in the document. For example:
For full sample code, please take a look at ElementReader, PDFPageTest and PDFDraw sample projects.
page_number | page to set the iterator on. 1 corresponds to the first page. |
PageLabel pdftron::PDF::PDFDoc::GetPageLabel | ( | int | page_num | ) |
SDF::Obj pdftron::PDF::PDFDoc::GetPages | ( | ) |
SDF::Obj pdftron::PDF::PDFDoc::GetRoot | ( | ) |
SDF::SDFDoc& pdftron::PDF::PDFDoc::GetSDFDoc | ( | ) |
SDF::SecurityHandler pdftron::PDF::PDFDoc::GetSecurityHandler | ( | ) |
SDF::SignatureHandler* pdftron::PDF::PDFDoc::GetSignatureHandler | ( | const SDF::SignatureHandlerId | signature_handler_id | ) |
Gets the associated signature handler instance from the signature manager by looking it up with the handler name.
signature_handler_id | The unique id of the signature handler to get. |
Struct::STree pdftron::PDF::PDFDoc::GetStructTree | ( | ) |
UInt64 pdftron::PDF::PDFDoc::GetTotalRemoteByteCount | ( | ) |
Returns the document's total size in bytes, when HasDownloader()
is True.
if | 'HasDownloader()` returns False, calling this method will result in an exception. |
SDF::Obj pdftron::PDF::PDFDoc::GetTrailer | ( | ) |
SDF::Obj pdftron::PDF::PDFDoc::GetTriggerAction | ( | PDFDoc::ActionTriggerEvent | trigger | ) |
SDF::UndoManager pdftron::PDF::PDFDoc::GetUndoManager | ( | ) |
PDFDocViewPrefs pdftron::PDF::PDFDoc::GetViewPrefs | ( | ) |
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.
bool pdftron::PDF::PDFDoc::HasDownloader | ( | ) |
Indicates whether this document was created via the PDFViewCtrl
method OpenURLAsync
.
PDFViewCtrl
method OpenURLAsync
; False otherwise. bool pdftron::PDF::PDFDoc::HasOC | ( | ) | const |
bool pdftron::PDF::PDFDoc::HasRepairedXRef | ( | ) | const |
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.
bool pdftron::PDF::PDFDoc::HasSignatures | ( | ) |
Indicates whether this documents contains any digital signatures.
|
static |
Imports two external PDFs and highlights the differences between them. This function directly adds the highlights to the two input documents. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit.
doc1 | is the before document, the basis of the comparison |
doc2 | is the after document, to which the basis is compared |
options | processing options (optional) |
std::vector<Page> pdftron::PDF::PDFDoc::ImportPages | ( | const std::vector< Page > & | pages, |
bool | import_bookmarks = false |
||
) |
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.
pages | A list of pages to import. All pages should belong to the same source document. |
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. |
bool pdftron::PDF::PDFDoc::InitSecurityHandler | ( | void * | custom_data = 0 | ) |
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.
An | exception is thrown if the matching handler for document's security was not found in the global SecurityManager. In this case, you need to register additional custom security handlers with the global SecurityManager (using SecurityManagerSingleton). |
custom_data | An optional parameter used to specify custom data that should be passed in SecurityHandler::Initialize() callback. |
bool pdftron::PDF::PDFDoc::InitStdSecurityHandler | ( | const char * | password, |
int | 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.
An | exception is thrown if the document's security Filter is not 'Standard'. In this case, you need to register additional custom security handlers with the global SecurityManager (SecurityManagerSingleton). |
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. |
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. |
bool pdftron::PDF::PDFDoc::InitStdSecurityHandler | ( | const pdftron::UString & | 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.
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. |
An | exception is thrown if the document's security Filter is not 'Standard'. In this case, you need to register additional custom security handlers with the global SecurityManager (SecurityManagerSingleton). |
bool pdftron::PDF::PDFDoc::InitStdSecurityHandler | ( | const std::vector< UInt8 > & | 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.
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. |
An | exception is thrown if the document's security Filter is not 'Standard'. In this case, you need to register additional custom security handlers with the global SecurityManager (SecurityManagerSingleton). |
void pdftron::PDF::PDFDoc::InsertPages | ( | int | insert_before_page_number, |
PDFDoc & | src_doc, | ||
int | start_page, | ||
int | end_page, | ||
enum InsertFlag | flag, | ||
Common::ProgressMonitor * | monitor = 0 |
||
) |
Inserts a range of pages from specified PDFDoc
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. |
src_doc | - source PDFDoc to insert from |
start_page | - start of the page number to insert |
end_page | - end of the page number to insert |
flag | - specifies insert options |
progress | - A pointer to the progress interface. NULL if progress tracking is not required. |
void pdftron::PDF::PDFDoc::InsertPages | ( | int | insert_before_page_number, |
PDFDoc & | src_doc, | ||
const PageSet & | source_page_set, | ||
enum InsertFlag | flag, | ||
Common::ProgressMonitor * | monitor = 0 |
||
) |
Inserts a range of pages from specified PDFDoc using PageSet
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. |
src_doc | - source PDFDoc to insert from |
source_page_set | - a collection of the page number to insert |
flag | - specifies insert options |
progress | - A pointer to the progress interface. NULL if progress tracking is not required. |
bool pdftron::PDF::PDFDoc::IsEncrypted | ( | ) |
bool pdftron::PDF::PDFDoc::IsLinearized | ( | ) | const |
Call this function to determine whether the document is represented in linearized (fast web view) format.
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.
bool pdftron::PDF::PDFDoc::IsModified | ( | ) | const |
Call this function to determine whether the document has been modified since it was last saved.
bool pdftron::PDF::PDFDoc::IsTagged | ( | ) |
void pdftron::PDF::PDFDoc::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().
void pdftron::PDF::PDFDoc::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.
void pdftron::PDF::PDFDoc::MergeXFDF | ( | Filters::Filter | stream, |
const MergeXFDFOptions * | opts = 0 |
||
) |
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.
stream |
|
opts |
|
PDFNetException |
void pdftron::PDF::PDFDoc::MergeXFDF | ( | const UString & | xfdf, |
const MergeXFDFOptions * | opts = 0 |
||
) |
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.
xfdf |
|
opts |
|
PDFNetException |
void pdftron::PDF::PDFDoc::MovePages | ( | int | move_before_page_number, |
PDFDoc & | src_doc, | ||
int | start_page, | ||
int | end_page, | ||
enum InsertFlag | flag, | ||
Common::ProgressMonitor * | monitor = 0 |
||
) |
Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move.
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. |
src_doc | - source PDFDoc to move from |
start_page | - start of the page number to move |
end_page | - end of the page number to move |
flag | - specifies insert options |
progress | - A pointer to the progress interface. NULL if progress tracking is not required. |
void pdftron::PDF::PDFDoc::MovePages | ( | int | move_before_page_number, |
PDFDoc & | src_doc, | ||
const PageSet & | source_page_set, | ||
enum InsertFlag | flag, | ||
Common::ProgressMonitor * | monitor = 0 |
||
) |
Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move.
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. |
src_doc | - source PDFDoc to move from |
source_page_set | - a collection of the page number to move |
flag | - specifies insert options |
progress | - A pointer to the progress interface. NULL if progress tracking is not required. |
|
inline |
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.
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:
The following is a listing of ISO standard page sizes:
void pdftron::PDF::PDFDoc::PageInsert | ( | PageIterator & | where, |
Page | page | ||
) |
Insert/Import a single page at a specific location in the page sequence.
where | - The location in the page sequence indicating where to insert the page. The page is inserted before the specified location. |
page | - A page to insert. |
void pdftron::PDF::PDFDoc::PagePushBack | ( | Page | page | ) |
Adds a page to the end of a document's page sequence.
page | - a page to append to the document |
void pdftron::PDF::PDFDoc::PagePushFront | ( | Page | page | ) |
Adds a page to the beginning of a document's page sequence.
page | - a page to prepend to the document Invalidates all PageIterators pointing to the document. |
void pdftron::PDF::PDFDoc::PageRemove | ( | const PageIterator & | page_itr | ) |
page_itr | - the PageIterator to the page that should be removed A PageIterator for the given page can be obtained using PDFDoc::GetPageIterator(page_num) or using direct iteration through document's page sequence. |
void pdftron::PDF::PDFDoc::RefreshAnnotAppearances | ( | const RefreshOptions * | options = 0 | ) |
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.
options | Options that can be used to adjust this generation process. |
void pdftron::PDF::PDFDoc::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.
void pdftron::PDF::PDFDoc::RemovePageLabel | ( | int | page_num | ) |
Removes the page label that is attached to the specified page, effectively merging the specified range with the previous page label sequence.
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. |
void pdftron::PDF::PDFDoc::RemoveSecurity | ( | ) |
This function removes document security.
void pdftron::PDF::PDFDoc::RemoveSignatureHandler | ( | const SDF::SignatureHandlerId | signature_handler_id | ) |
Removes a signature handler from the signature manager.
signature_handler_id | The unique id of the signature handler to remove. |
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.
path | - The full path name to which the file is saved. |
flags | - A bit field composed of an OR of SDFDoc::SaveOptions values. |
- | if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown. |
void pdftron::PDF::PDFDoc::Save | ( | const UString & | path, |
UInt32 | flags, | ||
Common::ProgressMonitor * | progress | ||
) |
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.
path | - The full path name to which the file is saved. |
flags | - A bit field composed of an OR of SDFDoc::SaveOptions values. |
progress | - A pointer to the progress interface. NULL if progress tracking is not required. |
- | if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown. |
std::vector<unsigned char> pdftron::PDF::PDFDoc::Save | ( | UInt32 | flags | ) |
void pdftron::PDF::PDFDoc::Save | ( | const char *& | out_buf, |
size_t & | out_buf_size, | ||
UInt32 | flags, | ||
Common::ProgressMonitor * | progress | ||
) |
Saves the document to a memory buffer.
out_buf | a pointer to the buffer containing the serialized version of the document. (C++ Note) The buffer is owned by a document and the client doesn't need to do any initialization or cleanup. |
out_buf_size | the size of the serialized document (i.e. out_buf) in bytes. |
flags | - A bit field composed of an OR of SDFDoc::SaveOptions values. |
progress | - A pointer to the progress interface. NULL if progress tracking is not required. |
- | if there is a problem during Save an Exception object will be thrown. |
void pdftron::PDF::PDFDoc::Save | ( | Filters::Filter & | stream, |
UInt32 | flags | ||
) |
Saves the document to a stream.
stream | The output stream where to write data. |
flags | - A bit field composed of an OR of the SDFDoc::SaveOptions values. |
- | if there is a problem during Save an Exception object will be thrown. |
void pdftron::PDF::PDFDoc::SaveCustomSignature | ( | const UChar * | in_signature, |
const size_t | in_signature_size, | ||
const DigitalSignatureField & | in_field, | ||
const UString & | in_path | ||
) |
Saves a custom signature Contents to a document which has been prepared to receive it. No changes should be made to document in meantime.
in_signature | The signature Contents to write |
in_signature_size | the size of the signature buffer |
in_field | The signature field to which to write |
in_path | The full path name to which the file is saved. |
- | if there is a problem during Save an Exception object will be thrown. |
void pdftron::PDF::PDFDoc::SaveCustomSignature | ( | const UChar * | in_signature, |
const size_t | in_signature_size, | ||
const DigitalSignatureField & | in_field, | ||
Filters::Filter & | out_stream | ||
) |
Saves a custom signature Contents to a document which has been prepared to receive it. No changes should be made to document in meantime.
in_signature | The signature Contents to write |
in_signature_size | the size of the signature buffer |
in_field | The signature field to which to write |
out_stream | The output stream where to write data. |
- | if there is a problem during Save an Exception object will be thrown. |
void pdftron::PDF::PDFDoc::SaveCustomSignature | ( | const UChar * | in_signature, |
const size_t | in_signature_size, | ||
const DigitalSignatureField & | in_field, | ||
const UChar *& | out_buf, | ||
size_t & | out_buf_size | ||
) |
Saves a custom signature Contents to a document which has been prepared to receive it. No changes should be made to document in meantime.
in_signature | The signature Contents to write |
in_signature_size | the size of the signature buffer |
in_field | The signature field to which to write |
out_buf | a pointer to the buffer containing the serialized version of the document. (C++ Note) The buffer is owned by a document and the client doesn't need to do any initialization or cleanup. |
out_buf_size | the size of the serialized document (i.e. out_buf) in bytes. |
- | if there is a problem during Save an Exception object will be thrown. |
void pdftron::PDF::PDFDoc::SaveViewerOptimized | ( | const UString & | path, |
const ViewerOptimizedOptions & | opts | ||
) |
Applies optimizations to improve viewing speed and saves the document to the specified file. The main optimizations used are linearization and embedding thumbnails for the first page and any complex pages.
path | The full path name to which the file is saved. |
opts | The optimization options |
if | the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown. |
void pdftron::PDF::PDFDoc::SaveViewerOptimized | ( | const char *& | out_buf, |
size_t & | out_buf_size, | ||
const ViewerOptimizedOptions & | opts | ||
) |
Applies optimizations to improve viewing speed and saves the document to a memory buffer. The main optimizations used are linearization and embedding thumbnails for the first page and any other pages that are slow to render.
out_buf | a pointer to the buffer containing the serialized version of the document. (C++ Note) The buffer is owned by a document and the client doesn't need to do any initialization or cleanup. |
out_buf_size | the size of the serialized document (i.e. out_buf) in bytes. |
opts | - The optimization options |
- | if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown. |
std::vector<unsigned char> pdftron::PDF::PDFDoc::SaveViewerOptimized | ( | const ViewerOptimizedOptions & | opts | ) |
void pdftron::PDF::PDFDoc::SetOpenAction | ( | const Action & | action | ) |
void pdftron::PDF::PDFDoc::SetPageLabel | ( | int | page_num, |
PageLabel & | 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.
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. |
void pdftron::PDF::PDFDoc::SetSecurityHandler | ( | const SDF::SecurityHandler & | handler | ) |
The function sets a new SecurityHandler as the current security handler.
handler | new SecurityHandler |
bool pdftron::PDF::PDFDoc::TryLock | ( | int | milliseconds = 0 | ) |
Try locking the document, waiting no longer than specified number of milliseconds.
milliseconds | - max number of milliseconds to wait for the document to lock |
bool pdftron::PDF::PDFDoc::TryLockRead | ( | int | milliseconds = 0 | ) |
Tries to obtain a read lock the document for <milliseconds> duration, and returns true if the lock was successfully acquired
milliseconds | duration to obtain a read lock for. |
void pdftron::PDF::PDFDoc::Unlock | ( | ) |
Removes the lock from the document.
void pdftron::PDF::PDFDoc::UnlockRead | ( | ) |
Removes the read lock from the document.
SignaturesVerificationStatus pdftron::PDF::PDFDoc::VerifySignedDigitalSignatures | ( | const VerificationOptions & | in_opts | ) | const |
Attempts to verify all signed cryptographic digital signatures in the document, ignoring unsigned signatures.