SignDoc SDK (C++)  5.0.0
SignDocDocument Class Reference

An interface for SignDoc documents. More...

#include <SignDocSDK-cpp.h>

Public Types

enum  DocumentType {
  dt_unknown, dt_pdf, dt_tiff, dt_other,
  dt_fdf
}
 Supported document types. More...
 
enum  SaveFlags {
  sf_incremental = 0x01, sf_remove_unused = 0x02, sf_linearized = 0x04, sf_pdf_1_4 = 0x08,
  sf_pdfa_buttons = 0x10, sf_auto_incremental = 0x20
}
 Flags modifying the behavior of saveToFile(), saveToMemory(), and saveToStream(). More...
 
enum  CopyToStreamFlags { ctsf_unsaved = 0x01 }
 Flags modifying the behavior of copyToStream() and copyToMemory(). More...
 
enum  SetFieldFlags {
  sff_font_fail = 0x01, sff_move = 0x08, sff_keep_ap = 0x10, sff_update_ap = 0x20,
  sff_fit_height_only = 0x40, sff_force_border_width = 0x80, sff_dont_break_lines = 0x100, sff_auto_alignment = 0x200,
  sff_ltr = 0x1000, sff_rtl = 0x2000, sff_default_ltr = 0x4000, sff_default_rtl = 0x8000
}
 Flags modifying the behavior of setField(), addField(), and applyFdf(). More...
 
enum  FlattenFieldsFlags { fff_include_signature_unsigned = 0x01, fff_include_signature_signed = 0x02, fff_include_hidden = 0x04, fff_keep_structure = 0x08 }
 Flags modifying the behavior of flattenFields(). More...
 
enum  FlattenAnnotationsFlags { faf_include_hidden = 0x04, faf_keep_structure = 0x08 }
 Flags modifying the behavior of flattenAnnotations(). More...
 
enum  FindTextFlags { ftf_ignore_hspace = 0x0001, ftf_ignore_hyphenation = 0x0002, ftf_ignore_sequence = 0x0004 }
 Flags modifying the behavior of findText(). More...
 
enum  ExportFlags { e_top = 0x01 }
 Flags modifying the behavior of exportFields(), exportFieldsToMemory(), exportProperties(), and exportPropertiesToMemory(). More...
 
enum  ImportFlags { i_atomic = 0x01 }
 Flags modifying the behavior of importProperties() and importPropertiesFromMemory(). More...
 
enum  ImportImageFlags { ii_keep_aspect_ratio = 0x01, ii_brightest_transparent = 0x02 }
 Flags modifying the behavior of addImageFromFile(), addImageFromFile2(), addImageFromMemory(), addImageFromMemory2(), importPageFromImageBlob(), importPageFromImageBlob2(), importPageFromImageFile(), and importPageFromImageFile2(). More...
 
enum  KeepOrRemove { kor_keep, kor_remove }
 Tell removePages() to keep or to remove the specified pages. More...
 
enum  CheckAttachmentResult { car_match, car_no_checksum, car_mismatch }
 Result of checkAttachment(). More...
 
enum  HAlignment {
  ha_left, ha_center, ha_right, ha_do_not_uses_this,
  ha_auto
}
 Horizontal alignment for addTextRect() and addTextRect2(). More...
 
enum  VAlignment { va_top, va_center, va_bottom }
 Vertical alignment for addTextRect() and addTextRect2(). More...
 
enum  AddTextRectFlags {
  atrf_compat = 0x01, atrf_ltr = 0x1000, atrf_rtl = 0x2000, atrf_default_ltr = 0x4000,
  atrf_default_rtl = 0x8000
}
 Flags for addTextRect() and addTextRect2(). More...
 
enum  Flags {
  f_relax_byte_range = 0x01, f_ambiguous_button_value_empty = 0x02, f_use_dss_only = 0x04, f_no_kerning_for_standard_fonts = 0x08,
  f_unused_0x10 = 0x10, f_keep_escape_sequences = 0x20, f_require_alternate_field_name = 0x40, f_require_lang = 0x80,
  f_insert_at_end = 0x100, f_use_escape_sequences = 0x200, f_fail_for_broken_target_structure = 0x400, f_no_actual_text = 0x800
}
 Flags for setFlags(). More...
 
enum  ShootInFootFlags {
  siff_allow_breaking_signatures = 0x01, siff_allow_breaking_permissions = 0x02, siff_allow_invalid_certificate = 0x04, siff_allow_non_standard_external_fonts = 0x08,
  siff_assume_ap_not_shared = 0x10, siff_assume_ap_shared = 0x20, siff_dont_verify_after_signing = 0x40, siff_allow_all_curves = 0x80,
  siff_allow_breaking_tagged_pdf = 0x100
}
 Flags for setShootInFoot(). More...
 
enum  UpdateDSSFlags { udf_simulate = 0x01, udf_vri = 0x02 }
 Flags for updateDSS() and updateDSS2(). More...
 

Public Member Functions

 SignDocDocument ()
 Constructor. More...
 
 ~SignDocDocument ()
 Destructor. More...
 
DocumentType getType () const
 Get the type of the document. More...
 
int getPageCount () const
 Get the number of pages. More...
 
ReturnCode createSignatureParameters (Encoding aEncoding, const std::string &aFieldName, const std::string &aProfile, std::unique_ptr< SignDocSignatureParameters > &aOutput)
 Create a SignDocSignatureParameters object for signing a signature field. More...
 
ReturnCode createSignatureParameters (const wchar_t *aFieldName, const wchar_t *aProfile, std::unique_ptr< SignDocSignatureParameters > &aOutput)
 Create a SignDocSignatureParameters object for signing a signature field. More...
 
ReturnCode createSignatureParametersForTimeStamp (std::unique_ptr< SignDocSignatureParameters > &aOutput)
 Create a SignDocSignatureParameters object for adding a document time stamp. More...
 
ReturnCode getProfiles (Encoding aEncoding, const std::string &aFieldName, std::vector< std::string > &aOutput)
 Get a list of profiles for a signature field. More...
 
ReturnCode addSignature (SignDocSignatureParameters *aSignatureParameters, const SignDocVerificationParameters *aVerificationParameters)
 Sign the document. More...
 
ReturnCode getLastTimestamp (std::string &aTime)
 Get the timestamp used by the last successful call of addSignature(). More...
 
ReturnCode getPathname (Encoding aEncoding, std::string &aPath)
 Get the current pathname of the document. More...
 
int getAvailableMethods ()
 Get a bitset indicating which signing methods are available for this document. More...
 
int getSignatureCount ()
 Get the number of signatures that can be retrieved with getSignature(). More...
 
ReturnCode getSignature (int aIndex, std::unique_ptr< SignDocSignature > &aOutput)
 Get a signature of the document. More...
 
ReturnCode verifySignature (Encoding aEncoding, const std::string &aFieldName, std::unique_ptr< SignDocVerificationResult > &aOutput)
 Verify a signature of the document. More...
 
ReturnCode verifySignature (const wchar_t *aFieldName, std::unique_ptr< SignDocVerificationResult > &aOutput)
 Verify a signature of the document. More...
 
ReturnCode verifySignature2 (const SignDocSignature &aSignature, std::unique_ptr< SignDocVerificationResult > &aOutput)
 Verify a signature of the document. More...
 
ReturnCode clearSignature (Encoding aEncoding, const std::string &aFieldName)
 Remove a signature of the document. More...
 
ReturnCode clearAllSignatures ()
 Remove all signatures of the document. More...
 
ReturnCode clearApprovalSignatures ()
 Remove all approval signatures of the document. More...
 
ReturnCode updateDSS (const SignDocVerificationParameters *aParameters, unsigned aFlags, int &aCount)
 Update the DSS for any eligible signatures in the document. More...
 
ReturnCode updateDSS2 (Encoding aEncoding, const std::string &aFieldName, const SignDocVerificationParameters *aParameters, unsigned aFlags)
 Update the DSS for a signature in the document. More...
 
ReturnCode saveToStream (OutputStream &aStream, int aFlags)
 Save the document to a stream. More...
 
ReturnCode saveToMemory (std::vector< unsigned char > &aBlob, int aFlags)
 Save the document to a blob. More...
 
ReturnCode saveToFile (Encoding aEncoding, const char *aPath, int aFlags)
 Save the document to a file. More...
 
ReturnCode saveToFile (const wchar_t *aPath, int aFlags)
 Save the document to a file. More...
 
ReturnCode copyToStream (OutputStream &aStream, unsigned aFlags)
 Copy the document's current status or backing file or backing blob to a stream. More...
 
ReturnCode copyToMemory (std::vector< unsigned char > &aBlob, unsigned aFlags)
 Copy the document's current status or backing file or backing blob to a blob. More...
 
ReturnCode copyAsSignedToStream (Encoding aEncoding, const std::string &aFieldName, OutputStream &aStream)
 Copy the document to a stream for viewing the document "as signed". More...
 
ReturnCode copyAsSignedToMemory (Encoding aEncoding, const std::string &aFieldName, std::vector< unsigned char > &aBlob)
 Copy the document to a blob for viewing the document "as signed". More...
 
ReturnCode getSaveToStreamFlags (int &aOutput)
 Get all flags currently valid for saveToStream() and saveToMemory(). More...
 
ReturnCode getSaveToFileFlags (int &aOutput)
 Get all flags currently valid for saveToFile(). More...
 
ReturnCode getRequiredSaveToFileFlags (int &aOutput)
 Get all flags currently required for saveToFile(). More...
 
ReturnCode getFields (int aTypes, std::vector< SignDocField > &aOutput)
 Get all interactive fields of the specified types. More...
 
ReturnCode getFieldsOfPage (int aPage, int aTypes, std::vector< SignDocField > &aOutput)
 Get all interactive fields of the specified page, in tab order. More...
 
ReturnCode getField (Encoding aEncoding, const std::string &aName, SignDocField &aOutput)
 Get an interactive field by name. More...
 
ReturnCode setField (SignDocField &aField, unsigned aFlags)
 Change a field. More...
 
ReturnCode addField (SignDocField &aField, unsigned aFlags)
 Add a field. More...
 
ReturnCode removeField (Encoding aEncoding, const std::string &aName)
 Remove a field. More...
 
ReturnCode flattenField (Encoding aEncoding, const std::string &aName, int aWidget)
 Flatten a field. More...
 
ReturnCode flattenFields (int aFirstPage, int aLastPage, unsigned aFlags)
 Flatten all fields of the document or of a range of pages. More...
 
ReturnCode exportFields (OutputStream &aStream, int aFlags)
 Export all fields as XML to a stream. More...
 
ReturnCode exportFieldsToMemory (std::vector< unsigned char > &aOutput, int aFlags)
 Export all fields as XML to a blob. More...
 
ReturnCode applyFdf (Encoding aEncoding, const char *aPath, unsigned aFlags)
 Apply an FDF document to a PDF document. More...
 
ReturnCode applyFdf (const wchar_t *aPath, unsigned aFlags)
 Apply an FDF document to a PDF document. More...
 
ReturnCode getTextFieldAttributes (SignDocTextFieldAttributes &aOutput)
 Get the document's default text field attributes. More...
 
ReturnCode setTextFieldAttributes (SignDocTextFieldAttributes &aData)
 Set the document's default text field attributes. More...
 
ReturnCode getProperties (const std::string &aCollection, std::vector< SignDocProperty > &aOutput)
 Get the names and types of all SignDoc properties of a certain collection of properties of the document. More...
 
ReturnCode getIntegerProperty (Encoding aEncoding, const std::string &aCollection, const std::string &aName, int &aValue)
 Get the value of a SignDoc property (integer). More...
 
ReturnCode getStringProperty (Encoding aEncoding, const std::string &aCollection, const std::string &aName, std::string &aValue)
 Get the value of a SignDoc property (string). More...
 
ReturnCode getBooleanProperty (Encoding aEncoding, const std::string &aCollection, const std::string &aName, bool &aValue)
 Get the value of a SignDoc property (boolean). More...
 
ReturnCode setIntegerProperty (Encoding aEncoding, const std::string &aCollection, const std::string &aName, int aValue)
 Set the value of a SignDoc property (integer). More...
 
ReturnCode setStringProperty (Encoding aEncoding, const std::string &aCollection, const std::string &aName, const std::string &aValue)
 Set the value of a SignDoc property (string). More...
 
ReturnCode setBooleanProperty (Encoding aEncoding, const std::string &aCollection, const std::string &aName, bool aValue)
 Set the value of a SignDoc property (boolean). More...
 
ReturnCode removeProperty (Encoding aEncoding, const std::string &aCollection, const std::string &aName)
 Remove a SignDoc property. More...
 
ReturnCode exportProperties (const std::string &aCollection, OutputStream &aStream, int aFlags)
 Export properties as XML to a stream. More...
 
ReturnCode exportPropertiesToMemory (const std::string &aCollection, std::vector< unsigned char > &aBlob, int aFlags)
 Export properties as XML to a blob. More...
 
ReturnCode importProperties (const std::string &aCollection, InputStream &aStream, int aFlags)
 Import properties from XML (reading a stream). More...
 
ReturnCode importPropertiesFromMemory (const std::string &aCollection, const unsigned char *aPtr, size_t aSize, int aFlags)
 Import properties from XML (reading a blob). More...
 
ReturnCode getResolution (int aPage, double &aResX, double &aResY)
 Get the resolution of a page. More...
 
ReturnCode getConversionFactors (int aPage, double &aFactorX, double &aFactorY)
 Get the conversion factors for a page. More...
 
ReturnCode getPageSize (int aPage, double &aWidth, double &aHeight)
 Get the size of a page. More...
 
ReturnCode getBitsPerPixel (int aPage, int &aBPP)
 Get the number of bits per pixel (TIFF only). More...
 
ReturnCode computeZoom (double &aOutput, const SignDocRenderParameters &aParams)
 Compute the zoom factor used for rendering. More...
 
ReturnCode convCanvasPointToPagePoint (Point &aPoint, const SignDocRenderParameters &aParams)
 Convert a point expressed in canvas (image) coordinates to a point expressed in document coordinate system of the specified page. More...
 
ReturnCode convPagePointToCanvasPoint (Point &aPoint, const SignDocRenderParameters &aParams)
 Convert a point expressed in document coordinate system of the specified page to a point expressed in canvas (image) coordinates. More...
 
ReturnCode convImageRectToPageRect (const SignDocImageRect &aInput, Rect &aOutput, const SignDocRenderParameters &aParams)
 Convert a rectangle expressed in canvas (image) coordinates to a rectangle expressed in document coordinate system of the specified page. More...
 
ReturnCode convPageRectToImageRect (const Rect &aInput, SignDocImageRect &aOutput, const SignDocRenderParameters &aParams)
 Convert a rectangle expressed in document coordinate system of the specified page to a rectangle expressed in canvas (image) coordinates. More...
 
ReturnCode renderPageAsImage (std::vector< unsigned char > &aImage, SignDocRenderOutput &aOutput, const SignDocRenderParameters &aRenderParameters, const SignDocVerificationParameters *aVerificationParameters, const Rect *aClipRect)
 Render the selected page (or pages) as image. More...
 
ReturnCode renderPageAsSignDocImage (std::unique_ptr< SignDocImage > &aImage, SignDocRenderOutput &aOutput, const SignDocRenderParameters &aRenderParameters, const SignDocVerificationParameters *aVerificationParameters, const Rect *aClipRect)
 Render the selected page (or pages) as SignDocImage object. More...
 
ReturnCode getRenderedSize (SignDocRenderOutput &aOutput, const SignDocRenderParameters &aRenderParameters)
 Get the size of the rendered page in pixels (without actually rendering it). More...
 
SignDocAnnotationcreateLineAnnotation (const Point &aStart, const Point &aEnd)
 Create a line annotation. More...
 
SignDocAnnotationcreateLineAnnotation (double aStartX, double aStartY, double aEndX, double aEndY)
 Create a line annotation. More...
 
SignDocAnnotationcreateScribbleAnnotation ()
 Create a scribble annotation. More...
 
SignDocAnnotationcreateFreeTextAnnotation (const Point &aLowerLeft, const Point &aUpperRight)
 Create a text annotation. More...
 
SignDocAnnotationcreateFreeTextAnnotation (double aX0, double aY0, double aX1, double aY1)
 Create a text annotation. More...
 
ReturnCode addAnnotation (int aPage, const SignDocAnnotation *aAnnot)
 Add an annotation to a page. More...
 
ReturnCode getAnnotations (Encoding aEncoding, int aPage, std::vector< std::string > &aOutput)
 Get a list of all named annotations of a page. More...
 
ReturnCode getAnnotation (Encoding aEncoding, int aPage, const std::string &aName, std::unique_ptr< SignDocAnnotation > &aOutput)
 Get a named annotation of a page. More...
 
ReturnCode removeAnnotation (Encoding aEncoding, int aPage, const std::string &aName)
 Remove an annotation identified by name. More...
 
ReturnCode addText (Encoding aEncoding, const std::string &aText, int aPage, double aX, double aY, const std::string &aFontName, double aFontSize, const SignDocColor &aTextColor, double aOpacity, int aFlags)
 Add text to a page. More...
 
ReturnCode addText2 (Encoding aEncoding, const std::string &aText, int aPage, double aX, double aY, const std::string &aFontName, double aFontSize, const SignDocColor &aTextColor, double aOpacity, int aFlags, const std::string &aLang)
 Add text to a page (with language identifier). More...
 
ReturnCode addTextRect (Encoding aEncoding, const std::string &aText, int aPage, double aX0, double aY0, double aX1, double aY1, const std::string &aFontName, double aFontSize, double aLineSkip, const SignDocColor &aTextColor, double aOpacity, HAlignment aHAlignment, VAlignment aVAlignment, int aFlags)
 Add text in a rectangle of a page (with line breaking). More...
 
ReturnCode addTextRect2 (Encoding aEncoding, const std::string &aText, int aPage, double aX0, double aY0, double aX1, double aY1, const std::string &aFontName, double aFontSize, double aLineSkip, const SignDocColor &aTextColor, double aOpacity, HAlignment aHAlignment, VAlignment aVAlignment, int aFlags, const std::string &aLang)
 Add text in a rectangle of a page (with line breaking and language identifier). More...
 
ReturnCode addWatermark (const SignDocWatermark &aInput)
 Add a watermark. More...
 
ReturnCode findText (Encoding aEncoding, int aFirstPage, int aLastPage, const std::string &aText, int aFlags, std::vector< SignDocFindTextOccurrence > &aOutput)
 Find text. More...
 
ReturnCode createTextIterator (int aFirstPage, int aLastPage, int aFlags, std::unique_ptr< SignDocTextIterator > &aOutput)
 Create an iterator that visits all the text of a range of pages. More...
 
ReturnCode addAttachmentBlob (Encoding aEncoding, const std::string &aName, const std::string &aDescription, const std::string &aType, const std::string &aModificationTime, const void *aPtr, size_t aSize, int aFlags)
 Add an attachment to the document. More...
 
ReturnCode addAttachmentFile (Encoding aEncoding1, const std::string &aName, const std::string &aDescription, const std::string &aType, Encoding aEncoding2, const std::string &aPath, int aFlags)
 Add an attachment (read from a file) to the document. More...
 
ReturnCode removeAttachment (Encoding aEncoding, const std::string &aName)
 Remove an attachment from the document. More...
 
ReturnCode changeAttachmentDescription (Encoding aEncoding, const std::string &aName, const std::string &aDescription)
 Change the description of an attachment of the document. More...
 
ReturnCode getAttachments (Encoding aEncoding, std::vector< std::string > &aOutput)
 Get a list of all attachments of the document. More...
 
ReturnCode getAttachment (Encoding aEncoding, const std::string &aName, SignDocAttachment &aOutput)
 Get information about an attachment. More...
 
ReturnCode checkAttachment (Encoding aEncoding, const std::string &aName, CheckAttachmentResult &aOutput)
 Check the checksum of an attachment. More...
 
ReturnCode getAttachmentBlob (Encoding aEncoding, const std::string &aName, std::vector< unsigned char > &aOutput)
 Get an attachment as blob. More...
 
ReturnCode getAttachmentStream (Encoding aEncoding, const std::string &aName, std::unique_ptr< InputStream > &aOutput)
 Get an InputStream for an attachment. More...
 
ReturnCode addPage (int aTargetPage, double aWidth, double aHeight)
 Add an empty page to the document. More...
 
ReturnCode importPages (int aTargetPage, SignDocDocument *aSource, int aSourcePage, int aPageCount, int aFlags)
 Import pages from another document. More...
 
ReturnCode importPageFromImageBlob (int aTargetPage, const unsigned char *aPtr, size_t aSize, double aZoom, double aWidth, double aHeight, int aFlags)
 Import a page from a blob containing an image. More...
 
ReturnCode importPageFromImageBlob2 (int aTargetPage, const unsigned char *aPtr, size_t aSize, double aZoom, double aWidth, double aHeight, int aFlags, Encoding aEncoding, const std::string &aDescription, const std::string &aLang)
 Import a page from a blob containing an image (with alternate description). More...
 
ReturnCode importPageFromImageFile (int aTargetPage, Encoding aEncoding, const std::string &aPath, double aZoom, double aWidth, double aHeight, int aFlags)
 Import a page from a file containing an image. More...
 
ReturnCode importPageFromImageFile2 (int aTargetPage, Encoding aEncoding, const std::string &aPath, double aZoom, double aWidth, double aHeight, int aFlags, Encoding aEncoding2, const std::string &aDescription, const std::string &aLang)
 Import a page from a file containing an image (with alternate description). More...
 
ReturnCode addImageFromMemory (int aTargetPage, const unsigned char *aPtr, size_t aSize, double aZoom, double aX, double aY, double aWidth, double aHeight, int aFlags)
 Add an image (from a blob) to a page. More...
 
ReturnCode addImageFromMemory2 (int aTargetPage, const unsigned char *aPtr, size_t aSize, double aZoom, double aX, double aY, double aWidth, double aHeight, int aFlags, Encoding aEncoding, const std::string &aDescription, const std::string &aLang)
 Add an image (from a blob) to a page (with alternate description). More...
 
ReturnCode addImageFromFile (int aTargetPage, Encoding aEncoding, const std::string &aPath, double aZoom, double aX, double aY, double aWidth, double aHeight, int aFlags)
 Add an image (from a file) to a page. More...
 
ReturnCode addImageFromFile2 (int aTargetPage, Encoding aEncoding, const std::string &aPath, double aZoom, double aX, double aY, double aWidth, double aHeight, int aFlags, Encoding aEncoding2, const std::string &aDescription, const std::string &aLang)
 Add an image (from a file) to a page (with alternate description). More...
 
ReturnCode removePages (const int *aPagesPtr, int aPagesCount, KeepOrRemove aMode)
 Remove pages from the document. More...
 
ReturnCode setCompatibility (int aMajor, int aMinor)
 Request to not make changes to the document which are incompatible with an older version of this class. More...
 
ReturnCode isModified (bool &aModified) const
 Check if the document has unsaved changes. More...
 
ReturnCode isTaggedPDF (bool &aTaggedPDF) const
 Check if the document is a Tagged PDF document. More...
 
ReturnCode setFlags (unsigned aFlags)
 Set flags modifying the behavior of various functions. More...
 
unsigned getFlags () const
 Get the flags set by setFlags(). More...
 
ReturnCode setCompressionLevel (int aLevel)
 Set the FlateDecode compression level. More...
 
int getDocMDP () const
 Get the DocMDP P value of the document's certification signature. More...
 
int getLockMDP () const
 Get the lowest lock MDP value of the signed signature fields. More...
 
ReturnCode removeDocMDP ()
 Remove any certification signature. More...
 
ReturnCode removePermissions (unsigned aFlags)
 Remove signatures that grant permissions. More...
 
ReturnCode removePDFA (unsigned aFlags)
 Remove PDF/A conformance. More...
 
ReturnCode removePDFUA (unsigned aFlags)
 Remove PDF/UA conformance. More...
 
ReturnCode removeLogicalStructure (unsigned aFlags)
 Remove the logical structure. More...
 
ReturnCode removeXFA (unsigned aFlags)
 Remove XFA (XML Forms Architecture) content. More...
 
std::string getDocumentLanguage (Encoding aEncoding) const
 Get the document's natural language. More...
 
ReturnCode setDocumentLanguage (Encoding aEncoding, const std::string &aLang)
 Set the document's natural language. More...
 
ReturnCode setDefaultDocumentLanguage (Encoding aEncoding, const std::string &aLang)
 Set the language identifier to be used if a language identifier is required but the document doesn't provide one. More...
 
ReturnCode setShootInFoot (unsigned aFlags)
 Disable safety checks. More...
 
unsigned getShootInFoot () const
 Get the flags set by setShootInFoot(). More...
 
const char * getErrorMessage (Encoding aEncoding) const
 Get an error message for the last function call. More...
 
const wchar_t * getErrorMessageW () const
 Get an error message for the last function call. More...
 
SPPDF_Document * getSPPDFDocument (bool aDestroy)
 Get the underlying SPPDF_Document object. More...
 
ReturnCode getPageLabel (int aPage, std::string &aOutput)
 Get the page label for a page number. More...
 
ReturnCode flattenAnnotations (int aFirstPage, int aLastPage, unsigned aFlags)
 Flatten all annotations of the document or of a range of pages. More...
 
 SignDocDocument (SIGNDOC_Document *aP)
 Internal function. More...
 
SIGNDOC_Document * getImpl ()
 Internal function. More...
 
const SIGNDOC_Document * getImpl () const
 Internal function. More...
 
void setImpl (SIGNDOC_Document *aP)
 Internal function. More...
 

Static Public Member Functions

static void splitEscapeSequences (const std::string &aInput, std::vector< std::string > &aOutput)
 Split a string obtained from a PDF text string into escape sequences and text segments. More...
 
static std::string withoutEscapeSequences (const std::string &aInput)
 Remove escape sequences specifying the natural language in text strings. More...
 
static std::string withEscapeSequence (const std::string &aText, const std::string &aLang)
 Prepend an escape sequence for specifying the natural language in a text string. More...
 

Detailed Description

An interface for SignDoc documents.

An object of this class represents one document.

Use SignDocDocumentLoader::loadFromMemory(), SignDocDocumentLoader::loadFromFile(), SignDocDocumentLoader::createPDF(), or SignDocDocumentLoader::createPDFA() to create objects.

If the document is loaded from a file, the file may remain in use until this object is destroyed or the document is saved to a different file with saveToFile(). Please do not change the file while there is a SignDocDocument object for it.

Use getErrorMessage() to get more information after a function call failed.

Constructors and destructors:

Getting basic information about the document:

Saving the document:

Working with interactive fields:

Signing signature fields:

Verifying and removing signatures:

Working with properties:

Working with pages:

Working with annotations:

Adding text to a page and finding text on pages:

Adding images to a page:

Working with attachments:

Other functions:

Member Enumeration Documentation

Flags for addTextRect() and addTextRect2().

Enumerator
atrf_compat 

Behave like addTextRect() of SignDoc SDK 4.2.0.8 and earlier.

If this flag is set, any sequence of CR and LF characters in the text starts a new paragraph (ie, text following such a sequence will be placed at the beginning of the next output line). In consequence, empty lines in the input do not produce empty lines in the output. To get an empty line in the output, you have to add a paragraph containing a non-breaking space (U+00A0) only:

"Line before empty line\n\xa0\nLine after empty line"

Moreover, lines can be broken only at a space character (U+0020).

If this flag is not set, the rules of UAX #14 will be used. In particular, CR, LF, and CR LF start a new paragraph and lines can be broken after punctuation.

atrf_ltr 

Paragraph direction: LTR.

If none of atrf_ltr, atrf_rtl, atrf_default_ltr, and atrf_default_rtl is set, atrf_ltr will be used.

At most one of atrf_ltr, atrf_rtl, atrf_default_ltr, and atrf_default_rtl can be set.

atrf_rtl 

Paragraph direction: RTL.

If none of atrf_ltr, atrf_rtl, atrf_default_ltr, and atrf_default_rtl is set, atrf_ltr will be used.

At most one of atrf_ltr, atrf_rtl, atrf_default_ltr, and atrf_default_rtl can be set.

This flag will be ignored if atrf_compat is set.

atrf_default_ltr 

Choose direction automatically, default to LTR.

The base direction of each paragraph (BiDi paragraph level) will depend on the first strong directional character in the paragraph.

The paragraph level will be 0 (LTR) for paragraphs having no strong directional character.

If none of atrf_ltr, atrf_rtl, atrf_default_ltr, and atrf_default_rtl is set, atrf_ltr will be used.

At most one of atrf_ltr, atrf_rtl, atrf_default_ltr, and atrf_default_rtl can be set.

This flag will be ignored if atrf_compat is set.

atrf_default_rtl 

Choose direction automatically, default to RTL.

The base direction of each paragraph (BiDi paragraph level) will depend on the first strong directional character in the paragraph.

The paragraph level will be 1 (RTL) for paragraphs having no strong directional character.

If none of atrf_ltr, atrf_rtl, atrf_default_ltr, and atrf_default_rtl is set, atrf_ltr will be used.

At most one of atrf_ltr, atrf_rtl, atrf_default_ltr, and atrf_default_rtl can be set.

This flag will be ignored if atrf_compat is set.

Result of checkAttachment().

Enumerator
car_match 

The attachment matches its checksum.

car_no_checksum 

The attachment does not have a checksum.

car_mismatch 

The attachment does not match its checksum.

Flags modifying the behavior of copyToStream() and copyToMemory().

Enumerator
ctsf_unsaved 

Include unsaved changes.

See copyToStream() and copyToMemory() for details.

Supported document types.

Enumerator
dt_unknown 

For SignDocDocumentLoader::ping().

dt_pdf 

PDF document.

dt_tiff 

TIFF document.

dt_other 

Other document.

dt_fdf 

FDF document.

Flags modifying the behavior of exportFields(), exportFieldsToMemory(), exportProperties(), and exportPropertiesToMemory().

Enumerator
e_top 

Include XML declaration and schema for top-level element.

Flags modifying the behavior of findText().

Enumerator
ftf_ignore_hspace 

Ignore horizontal whitespace (may be required).

If this flag is set, horizontal whitespace will be removed from the stream of characters read from the document (but not from the text being sought).

The following characters will be ignored:

  • U+0009 (CHARACTER TABULATION)
  • U+0020 (SPACE)
  • U+00A0 (NO-BREAK SPACE)
  • U+1361 (ETHIOPIC WORDSPACE)
  • U+1680 (OGHAM SPACE MARK)
  • U+2000 (EN QUAD)
  • U+2001 (EM QUAD)
  • U+2002 (EN SPACE)
  • U+2003 (EM SPACE)
  • U+2004 (THREE-PER-EM SPACE)
  • U+2005 (FOUR-PER-EM SPACE)
  • U+2006 (SIX-PER-EM SPACE)
  • U+2007 (FIGURE SPACE)
  • U+200B (PUNCTUATION SPACE)
  • U+2009 (THIN SPACE)
  • U+200A (HAIR SPACE)
  • U+200B (ZERO WIDTH SPACE)
  • U+200C (ZERO WIDTH NON-JOINER)
  • U+200D (ZERO WIDTH JOINER)
  • U+202F (NARROW NO-BREAK SPACE)
  • U+205F (MEDIUM MATHEMATICAL SPACE)
  • U+2060 (WORD JOINER)
  • U+3000 (IDEAGRAPHIC SPACE)
  • U+303F (IDEOGRAPHIC HALF FILL SPACE)
  • U+FEFF (ZERO WIDTH NO-BREAK SPACE)
ftf_ignore_hyphenation 

Ignore hyphenation.

If this flag is set, hyphen characters will be removed from the stream of characters read from the document (but not from the text being sought).

The following characters will be ignored:

  • U+002D (HYPHEN-MINUS)
  • U+00AD (SOFT HYPHEN)
  • U+058A (ARMENIAN HYPHEN)
  • U+1400 (CANADIAN SYLLABICS HYPHEN)
  • U+1806 (MONGOLIAN TODO SOFT HYPHEN)
  • U+1860 (BALINESE PAMENENG)
  • U+2010 (HYPHEN)
  • U+2011 (NON-BREAKING HYPHEN)
  • U+2012 (FIGURE-DASH)
  • U+2013 (EN-DASH)
  • U+2014 (EM-DASH)
  • U+2015 (HORIZONTAL BAR)
  • U+2027 (HYPHENATION POINT)
  • U+2043 (HYPHEN BULLET)
  • U+2212 (MINUS SIGN)
  • U+2796 (HEAVY MINUS SIGN)
  • U+2E17 (DOUBLE OBLIQUE HYPHEN)
  • U+2E40 (DOUBLE HYPHEN)
  • U+30A0 (KATAKANA-HIRAGANA DOUBLE HYPHEN)
  • U+FE63 (SMALL HYPHEN-MINUS)
  • U+FF0D (FULLWIDTH HYPHEN-MINUS)
  • U+10191 (ROMAN UNICA SIGN)
ftf_ignore_sequence 

Use character positions instead of searching the characters in the document in the sequence they are encountered.

This can be expensive. This flag is not yet implemented.

enum Flags

Flags for setFlags().

See also
getFlags(), setFlags()
Enumerator
f_relax_byte_range 

Relax checking of ByteRange.

If this flag is set, ByteRange may have any values allowed by ISO 32000-1:2008. If this flag is not set, verifySignature() and verifySignature2() behave like Adobe Reader: ByteRange must have two ranges, sorted by offset, and covering the complete document. (Covering the complete document is required for PAdES, the other two criterions are not.)

This flag is used for PDF documents only, it is ignored for TIFF documents.

See also
verifySignature(), verifySignature2()
f_ambiguous_button_value_empty 

Make exportFields(), exportFieldsToMemory(), getField(), getFields(), and getFieldsOfPage() return an empty button value if there are multiple non-Off values for a check box field.

An empty button value will make setField() fail. Set this flag if you want to detect check box fields with ambiguous button values or if you want to keep the behavior of SignDoc SDK 4.0 and earlier.

If this flag is not set, the first non-Off value of a check box field will be used as button value. The ordering used for determining the first non-Off value is unspecified and may change with different versions of SignDoc SDK.

This flag is used for PDF documents only, it is ignored for TIFF documents.

f_use_dss_only 

Use only the Document Security Store for building the certificate chain and for checking the revocation state of the certificates, ignore any certificates, CRLs, and OCSP responses from the signature proper.

This flag is used for testing of verifySignature() and verifySignature2().

f_no_kerning_for_standard_fonts 

Disable kerning for standard fonts.

This flag is used for testing.

f_unused_0x10 

Unused flag.

Formerly f_prevent_breaking_tagged_pdf, now ignored.

See also
siff_allow_breaking_tagged_pdf
f_keep_escape_sequences 

Do not remove escape sequences specifying the natural language from text strings.

In PDF, text strings can contain escape sequences which specify the natural language (and optionally, the country) of the text. By default, those escape sequences are removed by functions like SignDocField::getAlternateName(). If this flag is set, those escape sequences are not removed.

If you serialize and deserialize a SignDocField object and this flag is not set, the escape sequences will get lost.

See also
withoutEscapeSequences(), f_use_escape_sequences
f_require_alternate_field_name 

Require alternate field names.

If this flag is set and the document claims PDF/UA conformance, addField() will require an alternate field name to be set and setField() won't allow removal of the alternate field name (by setting it to an empty string). If a PDF/UA document does not specify a natural language, the alternate field name must start with an escape sequence specifying the language (see f_use_escape_sequences).

If this flag is not set and the document claims PDF/UA conformance, addField() will use the fully qualified field name as alternate field name. If the document does not provide a natural language, "en" (or the language set with setDefaultDocumentLanguage()) will be used. setField() behaves likewise if the alternate field name is removed (by setting it to an empty string). If a PDF/UA document does not specify a natural language and the alternate field name does not start with an escape sequence specifying the language, language identifier "en" (or the language set with setDefaultDocumentLanguage()) will be used (see f_use_escape_sequences).

See also
getDocumentLanguage(), setDefaultDocumentLanguage(), setDocumentLanguage(), withEscapeSequence(), f_use_escape_sequences, SignDocField::setAlternateName()
f_require_lang 

Require language identifier for text.

If this flag is set and the document claims PDF/UA conformance and does not provide a natural language, addText2() will fail unless a language identifier is passed in aLang and addText() will always fail.

If this flag is not set and the document claims PDF/UA conformance and does not provide a natural language, addText() and addText2() will use language identifier "en" (or the language set with setDefaultDocumentLanguage()) unless a language identifier is passed in aLang of addText2() or addTextRect2().

See also
getDocumentLanguage(), setDefaultDocumentLanguage(), setDocumentLanguage()
f_insert_at_end 

Do not attempt to insert new objects into the logical structure in reading order.

If inserting in reading order fails or if this flag is set, new objects will be inserted at the end of the page's logical structure.

f_use_escape_sequences 

Use escape sequences to encode the natural language in alternate field names.

If a natural language for an alternate field name is provided by the caller (by using an escape sequence) or if SignDoc SDK provides a default natural language for an alternate name, this flag controls how the natural language will be encoded in the document:

If this flag is set, the natural language will be encoded in the string, enabling different languages for the alternate field names of different fields. However, this is quite useless, as currently existing assistive technologies do not support escape sequences.

If this flag is not set and the document does provide a natural language, any escape sequences will be removed from the alternate field name.

If this flag is not set and the document does not provide a natural language, the document's natural language will be set to the natural language of the alternate name.

See also
f_keep_escape_sequences, f_require_alternate_field_name
f_fail_for_broken_target_structure 

Fail if a new object cannot be inserted into the logical structure of the target document due to that logical structure being broken.

If this flag is not set and insertion into the logical structure fails due to that logical structure being broken, the logical structure will not be modified.

See also
addAnnotation(), addField(), addImageFromFile(), addImageFromFile2(), addImageFromMemory(), addImageFromMemory2(), addText(), addText2(), addTextRect(), addTextRect2(), importPageFromImageBlob(), importPageFromImageBlob2(), importPageFromImageFile(), importPageFromImageFile2(), importPages(), setField(), siff_allow_breaking_tagged_pdf
f_no_actual_text 

Do not add Actualtext property to marked-content sequences.

This flag is used for testing.

If this flag is not set, ActualText is added when needed, ie, when the original text cannot be reconstructed by using ToUnicode.

This flag has the same numeric value as SignDocDocument::f_no_actual_text.

Flags modifying the behavior of flattenAnnotations().

Enumerator
faf_include_hidden 

Include hidden and invisible annotations.

faf_keep_structure 

Do not modify logical structure.

Set this flag only if you don't care about the logical structure of the document and fear problems due to errors in the logical structure. For instance, you might want to use this flag if flattening annotations just for printing with a PDF component that does not support annotations and then throw away the document with the flattened annotations.

Flags modifying the behavior of flattenFields().

Enumerator
fff_include_signature_unsigned 

Include unsigned signature fields.

fff_include_signature_signed 

Include signed signature fields.

fff_include_hidden 

Include hidden and invisible widgets.

fff_keep_structure 

Do not modify logical structure.

Set this flag only if you don't care about the logical structure of the document and fear problems due to errors in the logical structure. For instance, you might want to use this flag if flattening fields just for printing with a PDF component that does not support annotations and then throw away the document with the flattened fields.

enum HAlignment

Horizontal alignment for addTextRect() and addTextRect2().

Enumerator
ha_left 

Align left.

ha_center 

Center.

ha_right 

Align right.

ha_do_not_uses_this 

Unused value.

ha_auto 

Align left if the text begins with an LTR run, align right if the text begins with an RTL run.

Flags modifying the behavior of importProperties() and importPropertiesFromMemory().

Enumerator
i_atomic 

Modify all properties from XML or none (on error)

Flags modifying the behavior of addImageFromFile(), addImageFromFile2(), addImageFromMemory(), addImageFromMemory2(), importPageFromImageBlob(), importPageFromImageBlob2(), importPageFromImageFile(), and importPageFromImageFile2().

Enumerator
ii_keep_aspect_ratio 

Keep aspect ratio of image, center image on white background.

ii_brightest_transparent 

Make the brightest color transparent.

This flag may be specified for addImageFromFile(), addImageFromFile2(), addImageFromMemory(), and addImageFromMemory2() only. importPageFromImageBlob(), importPageFromImageBlob2(), importPageFromImageFile(), and importPageFromImageFile2() always make the image opaque.

The rest of this description applies to addImageFromFile(), addImageFromFile2(), addImageFromMemory(), addImageFromMemory2() only.

If the image has an alpha channel (or if its palette contains a transparent color), this flag will be ignored and the image's transparency will be used.

Transparency is not supported for JPEG images and JPEG-compressed TIFF images.

If this flag is not set, the image will be opaque unless the image has an alpha channel or transparent colors in its palette.

If this flag is set (and the image doesn't have an alpha channel and doesn't have transparent colors in its palette), white will be made transparent for truecolor images and the brightest color in the palette will be made transparent for indexed images (including grayscale images).

Tell removePages() to keep or to remove the specified pages.

Enumerator
kor_keep 

Keep the specified pages, remove all other pages.

kor_remove 

Remove the specified pages, keep all other pages.

enum SaveFlags

Flags modifying the behavior of saveToFile(), saveToMemory(), and saveToStream().

Enumerator
sf_incremental 

Save incrementally (PDF).

See also
sf_auto_incremental
sf_remove_unused 

Remove unused objects (PDF).

This flag is ignored, unused objects are always removed.

sf_linearized 

Linearize the document (PDF).

This flag cannot be used with sf_incremental.

Note
This flag is currently ignored, it will be supported again in a future version of SignDoc SDK.
sf_pdf_1_4 

Do not use features introduced after PDF 1.4 for saving the document.

This flag is assumed to be set for PDF 1.4 (and older) documents (PDF).

sf_pdfa_buttons 

Fix appearance streams of check boxes and radio buttons for conformance with PDF/A-1 without Technical Corrigendum 2.

The appearance streams of a check box or radio button field added by addField() or modified by setField() or applyFdf() do not conform to ISO 19005-1:2005 before Technical Corrigendum 2 (TC2). The relevant wording was fixed in TC2.

To make the appearance streams of check boxes and radio buttons conform to ISO 19005-1:2005 before TC2, save the document with this flag set. The document will be modified in memory and then saved. The document will not conform to TC2 and later versions of ISO 19005.

This flag is observed even if the document does not claim PDF/A-1 conformance.

Note
After "fixing" appearance streams, check boxes and radio buttons can no longer be modified or operated as the button values (ie, the set of possible values) is lost.
See also
SignDocSignatureParameters::pb_auto, SignDocSignatureParameters::pb_freeze
sf_auto_incremental 

Automatically set sf_incremental if needed, automatically reset sf_incremental if not allowed.

If this flag is set, SignDoc SDK will save the document incrementally or non-incrementally as needed; if you prefer saving incrementally, also set the sf_incremental flag. If you prefer saving non-incrementally, do not set the sf_incremental flag.

Flags modifying the behavior of setField(), addField(), and applyFdf().

Enumerator
sff_font_fail 

Fail if no suitable font is found.

setField(), addField(), and applyFdf() won't modify/add the field and will report error ReturnCode::rc_font_not_found if no font covering all required characters is found.

This flag is provided for compatibility with existing code; setField(), addField(), and applyFdf() now always assume this flag is set.

sff_move 

Move or resize field.

setField() does not update the coordinates of the field unless this flag is set as moving a field may require recomputing the appearance which can have unexpected results (for instance, Adobe Acrobat and SignDoc SDK use different designs for check marks). If this flag is not set, setField() ignores the coordinates set with SignDocField::setLeft(), SignDocField::setBottom(), SignDocField::setRight(), and SignDocField::setTop().

addField() ignores this flag, it always uses the coordinates. applyFdf() ignores this flag, it never moves or resizes fields.

In documents using Tagged PDF, widgets can be moved only within the page, they cannot be moved to a different page.

sff_keep_ap 

Keep appearance streams.

If this flag is set, setField() and applyFdf() won't touch the existing (or non-existing) appearance streams, addField() won't add any appearance streams.

Recomputing the appearance can have unexpected results (for instance, Adobe Acrobat and SignDoc SDK use different designs for chedck marks), therefore you might want to set this flag if you make changes that shall not affect the appearance such as setting the SignDocField::f_ReadOnly flag.

At most one of sff_keep_ap and sff_update_ap can be set.

See also
sff_update_ap
sff_update_ap 

Update appearance streams.

If this flag is set, setField() and applyFdf() will always recompute the appearance streams of the field. (addField() always computes the appearance stream unless sff_keep_ap is set).

You might want to use this flag after changing the document's default text field attributes.

At most one of sff_keep_ap and sff_update_ap can be set.

If neither sff_keep_ap and sff_update_ap is set, setField() and applyFdf() try to update the appearance streams only if necessary; the exact behavior depends on the version of SignDoc SDK.

See also
sff_keep_ap, setTextFieldAttributes()
sff_fit_height_only 

Compute the default font size such that the field contents fit the height of the field.

If the font size for a text field, list box field, or combo box field is zero (see SignDocTextFieldAttributes::setFontSize()), the default font size will be used. This flag controls how the default font size is computed.

If this flag is set, the font size will be computed such that the field contents fit the height of the field. This is the behavior required by the PDF specification. If the field contents are too long, they will be truncated.

If this flag is not set, the font size will be computed such that the field contents fit both the height and the width of the field. This is the behavior implemented in, for instance, Adobe Acrobat.

This flag is assumed to be not set if line breaking is enabled.

sff_force_border_width 

Use the border width specified by the field even if that will obliterate the field contents.

If this flag is set, the behavior matches that of Adobe Acrobat. If this flag is not set, the border width will be reduced to 1/16 of the field height or field width (whichever is smaller) if the border width specified by the field wouldn't leave enough space for the field contents.

sff_dont_break_lines 

Do not break lines in multiline text fields.

You can use this flag to simulate the behavior of SignDoc SDK 4.0 and earlier.

sff_auto_alignment 

Align left if the text begins with an LTR run, align right if the text begins with an RTL run.

This flag overrides for creating the appearance stream SignDocField::j_left and SignDocField::j_right set by SignDocField::setJustification(). This flag is ignored for SignDocField::j_center.

sff_ltr 

Paragraph direction: LTR.

If none of sff_ltr, sff_rtl, sff_default_ltr, and sff_default_rtl is set, sff_ltr will be used.

At most one of sff_ltr, sff_rtl, sff_default_ltr, and sff_default_rtl can be set.

See also
sff_auto_alignment
sff_rtl 

Paragraph direction: RTL.

If none of sff_ltr, sff_rtl, sff_default_ltr, and sff_default_rtl is set, sff_ltr will be used.

At most one of sff_ltr, sff_rtl, sff_default_ltr, and sff_default_rtl can be set.

Usage of sff_rtl is not recommended as the visual representation of the value of the field may not match the value of the field (as interpreted by software which does not know that the paragraph direction is supposed to be RTL). Use sff_rtl only as last resort if you cannot modify the text received from an RTL input field appropriately for paragraph direction LTR used in PDF fields.

See also
sff_auto_alignment
sff_default_ltr 

Choose direction automatically, default to LTR.

The base direction of each paragraph (BiDi paragraph level) will depend on the first strong directional character in the paragraph.

The paragraph level will be 0 (LTR) for paragraphs having no strong directional character.

If none of sff_ltr, sff_rtl, sff_default_ltr, and sff_default_rtl is set, sff_ltr will be used.

At most one of sff_ltr, sff_rtl, sff_default_ltr, and sff_default_rtl can be set.

Usage of sff_default_ltr is not recommended as the visual representation of the value of the field may not match the value of the field (as interpreted by software which does not know that the paragraph direction is supposed to be default-LTR). Use sff_default_ltr only as last resort if you cannot modify the text received from a default-LTR input field appropriately for paragraph direction LTR used in PDF fields.

See also
sff_auto_alignment
sff_default_rtl 

Choose direction automatically, default to RTL.

The base direction of each paragraph (BiDi paragraph level) will depend on the first strong directional character in the paragraph.

The paragraph level will be 1 (RTL) for paragraphs having no strong directional character.

If none of sff_ltr, sff_rtl, sff_default_ltr, and sff_default_rtl is set, sff_ltr will be used.

At most one of sff_ltr, sff_rtl, sff_default_ltr, and sff_default_rtl can be set.

Usage of sff_default_rtl is not recommended as the visual representation of the value of the field may not match the value of the field (as interpreted by software which does not know that the paragraph direction is supposed to be default-RTL). Use sff_default_rtl only as last resort if you cannot modify the text received from a default-RTL input field appropriately for paragraph direction LTR used in PDF fields.

See also
sff_auto_alignment

Flags for setShootInFoot().

Enumerator
siff_allow_breaking_signatures 

Allow operations to break existing signatures in signature fields.

This flag is available for PDF documents only.

siff_allow_breaking_permissions 

Allow operations to break signatures which grant permissions.

This flag is available for PDF documents only.

siff_allow_invalid_certificate 

Allow signing with a certificate that is not yet valid or no longer valid or which is not qualified for digital signatures.

siff_allow_non_standard_external_fonts 

Allow non-standard usage of external (non-embedded) TrueType and CFF fonts.

If this flag is not set, TrueType and CFF fonts must be embedded; when trying to use a TrueType or CFF font that is not embededded, error ReturnCode::rc_font_not_found will be reported.

If this flag is set, external TrueType and CFF fonts are allowed. However, the document will violate Table 117, section 9.7.4.2 and section 9.7.5.2 of ISO 32000-1:2008.

siff_assume_ap_not_shared 

Assume that appearance dictionaries and appearance streams are not shared.

If this flag is set and that assumption doesn't hold, changing one field may change the appearances of other fields.

At most one of siff_assume_ap_not_shared and siff_assume_ap_shared can be set. If neither flag is set, setField() and addSignature() look for shared objects. This can be expensive in terms of time and memory.

siff_assume_ap_shared 

Always assume that appearance dictionaries and appearance streams are shared.

Setting this flag partially simulates the behavior of SignDoc SDK 3.x and older and causes a minor violation of section 12.7.3.3 of ISO 32000-1:2008 by setField().

At most one of siff_assume_ap_not_shared and siff_assume_ap_shared can be set. If neither flag is set, setField() and addSignature() look for shared objects. This can be expensive in terms of time and memory.

siff_dont_verify_after_signing 

Disable verification of signature after signing by addSignature().

You might want to set this flag if you always perform a complete verification with verifySignature() after calling addSignature().

siff_allow_all_curves 

Allow elliptic curves for signing which are not supported by Adobe products for Windows.

As of August 2016, Adobe Acrobat XI and 2015 for Windows support these curves: secp192r1 (prime192v1), secp256r1 (prime256v1), secp224r1, secp384r1, and secp521r1.

Setting this flag enables additional curves: prime192v2, prime192v3, prime239v1, prime239v2, prime239v3, secp112r1, secp112r2, secp160r1, secp160k1, secp256k1, secp128r1, secp128r2, secp160r2, secp192k1, secp224k1, brainpoolp160r1, brainpoolp192r1, brainpoolp224r1, brainpoolp256r1, brainpoolp320r1, brainpoolp384r1, and brainpoolp512r1. However, most of these are not supported (for signing and verifying) by SignDoc SDK for iOS, OS X, and Windows Store apps due to limitations of those operating systems.

This flag is ignored (and assumed to be set) for TIFF documents. This flag is ignored if SignDocSignatureParameters::setPKCS7() is used.

siff_allow_breaking_tagged_pdf 

Allow operations to break Tagged PDF (and PDF/UA).

If this flag is not set, operations that would break Tagged PDF will report an error.

If this flag is set, all operations may break Tagged PDF without reporting an error. The target document's logical structure may be broken or incomplete (and thus violating PDF/UA) after such an operation.

This flag is available for PDF documents only.

See also
isTaggedPDF(), f_fail_for_broken_target_structure

Flags for updateDSS() and updateDSS2().

Enumerator
udf_simulate 

Perform all the checks but do not modify the document.

udf_vri 

Create VRI dictionaries.

This is discouraged by ETSI TS 103 172 V2.2.2 section 8.1.1.

enum VAlignment

Vertical alignment for addTextRect() and addTextRect2().

Enumerator
va_top 

Align top.

va_center 

Center.

va_bottom 

Align bottom.

Constructor & Destructor Documentation

~SignDocDocument ( )
inline

Destructor.

See also
getSPPDFDocument()
SignDocDocument ( SIGNDOC_Document *  aP)
inline

Internal function.

Member Function Documentation

ReturnCode addAnnotation ( int  aPage,
const SignDocAnnotation aAnnot 
)
inline

Add an annotation to a page.

See SignDocAnnotation for details.

Parameters
[in]aPageThe page number (1 for the first page).
[in]aAnnotPointer to the new annotation. Ownership remains at the caller.
Returns
ReturnCode::rc_ok iff successful.
See also
createLineAnnotation(), createScribbleAnnotation(), createFreeTextAnnotation(), f_fail_for_broken_target_structure
ReturnCode addAttachmentBlob ( Encoding  aEncoding,
const std::string &  aName,
const std::string &  aDescription,
const std::string &  aType,
const std::string &  aModificationTime,
const void *  aPtr,
size_t  aSize,
int  aFlags 
)
inline

Add an attachment to the document.

Attachments are supported for PDF documents only.

Parameters
[in]aEncodingThe encoding of aName and aDescription.
[in]aNameThe name of the attachment. Will also be used as filename of the attachment and must not contain slashes, backslashes, and colons.
[in]aDescriptionThe description of the attachment (can be empty).
[in]aTypeThe MIME type of the attachment (can be empty except for PDF/A-3 documents).
[in]aModificationTimeThe time and date of the last modification of the file being attached to the document (can be empty). Must be in ISO 8601 extended calendar date format with optional timezone.
[in]aPtrPointer to the first octet of the attachment.
[in]aSizeThe size (in octets) of the attachment.
[in]aFlagsMust be zero.
Returns
ReturnCode::rc_ok iff successful.
See also
addAttachmentFile(), getAttachments(), removeAttachment()
ReturnCode addAttachmentFile ( Encoding  aEncoding1,
const std::string &  aName,
const std::string &  aDescription,
const std::string &  aType,
Encoding  aEncoding2,
const std::string &  aPath,
int  aFlags 
)
inline

Add an attachment (read from a file) to the document.

Attachments are supported for PDF documents only.

Parameters
[in]aEncoding1The encoding of aName and aDescription.
[in]aNameThe name of the attachment. Will also be used as filename of the attachment and must not contain slashes, backslashes, and colons.
[in]aDescriptionThe description of the attachment (can be empty).
[in]aTypeThe MIME type of the attachment (can be empty except for PDF/A-3 documents).
[in]aEncoding2The encoding of aPath.
[in]aPathThe pathname of the file to be attached.
[in]aFlagsMust be zero.
Returns
ReturnCode::rc_ok iff successful.
See also
addAttachmentBlob(), getAttachments(), removeAttachment()
ReturnCode addField ( SignDocField aField,
unsigned  aFlags 
)
inline

Add a field.

See the members of SignDocField for details.

This function can add check boxes, radio button groups, text fields, and signature fields to PDF documents.

When adding a radio button group or a check box field, a value must be set, see SignDocField::setValue() and SignDocField::setValueIndex().

The SignDocField::f_NoToggleToOff flag should be set for all radio button groups. Adobe products seem to ignore this flag being not set.

When adding a text field, the justification must be set with SignDocField::setJustification().

Currently, you don't have control over the appearance of the field being inserted except for the text field attributes.

Adding a field to a PDF document that doesn't contain any fields will set the document's default text field attributes to font Helvetica, font size 0, text color black.

Only signature fields can be added to PDF documents having signed signature fields.

TIFF documents support signature fields only and all signature fields must be inserted before the first signature is added to the document (you may want to use invisible fields) unless all existing signature fields have flag SignDocField::f_EnableAddAfterSigning set.

Parameters
[in,out]aFieldThe new field. The font resource name of the default text field attributes may be modified. The value index and the value may be modified for radio button fields and check box fields.
[in]aFlagsSet of flags (of enum SetFieldFlags, combined with `|') modifying the behavior of this function. Pass 0 for no flags.
Returns
ReturnCode::rc_ok iff successful.
See also
getField(), removeField(), setField(), setTextFieldAttributes(), f_fail_for_broken_target_structure, f_require_alternate_field_name
ReturnCode addImageFromFile ( int  aTargetPage,
Encoding  aEncoding,
const std::string &  aPath,
double  aZoom,
double  aX,
double  aY,
double  aWidth,
double  aHeight,
int  aFlags 
)
inline

Add an image (from a file) to a page.

This function behaves like addImageFromFile2() with an empty string for aDescription, that is, if the document uses Tagged PDF, a dummy alternate description for the image ("image" with language code "en") will provided to avoid breaking standard compliance. It is strongly recommended to use addImageFromFile2() with a meaningful description of the image.

This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aTargetPageThe 1-based number of the page.
[in]aEncodingThe encoding of aPath.
[in]aPathThe pathname of the file containing the image. Supported formats for inserting into PDF documents are: JPEG, PNG, GIF, TIFF, and BMP.
[in]aZoomZoom factor or zero. If this argument is non-zero, aWidth and aHeight must be zero. The size of the page is computed from the image size and resolution, multiplied by aZoom.
[in]aXThe X coordinate of the point at which the lower left corner of the image shall be placed.
[in]aYThe Y coordinate of the point at which the lower left corner of the image shall be placed.
[in]aWidthImage width (document coordinates) or zero. The image will be scaled to this width. If this argument is non-zero, aZoom must be zero and either aHeight must be non-zero or ii_keep_aspect_ratio must be set in aFlags.
[in]aHeightImage height (document coordinates) or zero. The image will be scaled to this height. If this argument is non-zero, aZoom must be zero and either aWidth must be non-zero or ii_keep_aspect_ratio must be set in aFlags.
[in]aFlagsFlags modifying the behavior of this function, See enum ImportImageFlags. ii_keep_aspect_ratio is not needed if aZoom is non-zero.
Returns
ReturnCode::rc_ok iff successful.
See also
addImageFromMemory(), addImageFromMemory2(), importPageFromImageBlob(), importPageFromImageBlob2(), isTaggedPDF(), f_fail_for_broken_target_structure
ReturnCode addImageFromFile2 ( int  aTargetPage,
Encoding  aEncoding,
const std::string &  aPath,
double  aZoom,
double  aX,
double  aY,
double  aWidth,
double  aHeight,
int  aFlags,
Encoding  aEncoding2,
const std::string &  aDescription,
const std::string &  aLang 
)
inline

Add an image (from a file) to a page (with alternate description).

This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aTargetPageThe 1-based number of the page.
[in]aEncodingThe encoding of aPath.
[in]aPathThe pathname of the file containing the image. Supported formats for inserting into PDF documents are: JPEG, PNG, GIF, TIFF, and BMP.
[in]aZoomZoom factor or zero. If this argument is non-zero, aWidth and aHeight must be zero. The size of the page is computed from the image size and resolution, multiplied by aZoom.
[in]aXThe X coordinate of the point at which the lower left corner of the image shall be placed.
[in]aYThe Y coordinate of the point at which the lower left corner of the image shall be placed.
[in]aWidthImage width (document coordinates) or zero. The image will be scaled to this width. If this argument is non-zero, aZoom must be zero and either aHeight must be non-zero or ii_keep_aspect_ratio must be set in aFlags.
[in]aHeightImage height (document coordinates) or zero. The image will be scaled to this height. If this argument is non-zero, aZoom must be zero and either aWidth must be non-zero or ii_keep_aspect_ratio must be set in aFlags.
[in]aFlagsFlags modifying the behavior of this function, See enum ImportImageFlags. ii_keep_aspect_ratio is not needed if aZoom is non-zero.
[in]aEncoding2The encoding of aDescription.
[in]aDescriptionAlternate description for the image. If this value is an empty string, aEncoding2 and aLang will be ignored. If this value is an empty string and the document uses Tagged PDF, "image" with language code "en" will be used to avoid breaking standard compliance. It is strongly recommended to use a meaningful description. Escape sequences must not be used.
[in]aLangLanguage identifier for aDescription. Unless aDescription is an empty string, this must be a string containing an RFC 3066 language tag. Example: "en-US".
Returns
ReturnCode::rc_ok iff successful.
See also
addImageFromMemory(), addImageFromMemory2(), importPageFromImageBlob(), importPageFromImageBlob2(), isTaggedPDF(), f_fail_for_broken_target_structure
ReturnCode addImageFromMemory ( int  aTargetPage,
const unsigned char *  aPtr,
size_t  aSize,
double  aZoom,
double  aX,
double  aY,
double  aWidth,
double  aHeight,
int  aFlags 
)
inline

Add an image (from a blob) to a page.

This function behaves like addImageFromMemory2() with an empty string for aDescription, that is, if the document uses Tagged PDF, a dummy alternate description for the image ("image" with language code "en") will provided to avoid breaking standard compliance. It is strongly recommended to use addImageFromMemory2() with a meaningful description of the image.

This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aTargetPageThe 1-based number of the page.
[in]aPtrPointer to the first octet of the blob containing the image. Supported formats for inserting into PDF documents are: JPEG, PNG, GIF, TIFF, and BMP.
[in]aSizeSize (in octets) of the blob pointed to by aPtr.
[in]aZoomZoom factor or zero. If this argument is non-zero, aWidth and aHeight must be zero. The size of the page is computed from the image size and resolution, multiplied by aZoom.
[in]aXThe X coordinate of the point at which the lower left corner of the image shall be placed.
[in]aYThe Y coordinate of the point at which the lower left corner of the image shall be placed.
[in]aWidthImage width (document coordinates) or zero. The image will be scaled to this width. If this argument is non-zero, aZoom must be zero and either aHeight must be non-zero or ii_keep_aspect_ratio must be set in aFlags.
[in]aHeightImage height (document coordinates) or zero. The image will be scaled to this height. If this argument is non-zero, aZoom must be zero and either aWidth must be non-zero or ii_keep_aspect_ratio must be set in aFlags.
[in]aFlagsFlags modifying the behavior of this function, See enum ImportImageFlags. ii_keep_aspect_ratio is not needed if aZoom is non-zero.
Returns
ReturnCode::rc_ok iff successful.
See also
addImageFromFile(), addImageFromFile2(), addImageFromMemory2(), importPageFromImageBlob(), importPageFromImageBlob2(), isTaggedPDF(), f_fail_for_broken_target_structure
ReturnCode addImageFromMemory2 ( int  aTargetPage,
const unsigned char *  aPtr,
size_t  aSize,
double  aZoom,
double  aX,
double  aY,
double  aWidth,
double  aHeight,
int  aFlags,
Encoding  aEncoding,
const std::string &  aDescription,
const std::string &  aLang 
)
inline

Add an image (from a blob) to a page (with alternate description).

This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aTargetPageThe 1-based number of the page.
[in]aPtrPointer to the first octet of the blob containing the image. Supported formats for inserting into PDF documents are: JPEG, PNG, GIF, TIFF, and BMP.
[in]aSizeSize (in octets) of the blob pointed to by aPtr.
[in]aZoomZoom factor or zero. If this argument is non-zero, aWidth and aHeight must be zero. The size of the page is computed from the image size and resolution, multiplied by aZoom.
[in]aXThe X coordinate of the point at which the lower left corner of the image shall be placed.
[in]aYThe Y coordinate of the point at which the lower left corner of the image shall be placed.
[in]aWidthImage width (document coordinates) or zero. The image will be scaled to this width. If this argument is non-zero, aZoom must be zero and either aHeight must be non-zero or ii_keep_aspect_ratio must be set in aFlags.
[in]aHeightImage height (document coordinates) or zero. The image will be scaled to this height. If this argument is non-zero, aZoom must be zero and either aWidth must be non-zero or ii_keep_aspect_ratio must be set in aFlags.
[in]aFlagsFlags modifying the behavior of this function, See enum ImportImageFlags. ii_keep_aspect_ratio is not needed if aZoom is non-zero.
[in]aEncodingThe encoding of aDescription.
[in]aDescriptionAlternate description for the image. If this value is an empty string, aEncoding and aLang will be ignored. If this value is an empty string and the document uses Tagged PDF, "image" with language code "en" will be used to avoid breaking standard compliance. It is strongly recommended to use a meaningful description. Escape sequences must not be used.
[in]aLangLanguage identifier for aDescription. Unless aDescription is an empty string, this must be a string containing an RFC 3066 language tag. Example: "en-US".
Returns
ReturnCode::rc_ok iff successful.
See also
addImageFromFile2(), addImageFromMemory(), importPageFromImageBlob(), importPageFromImageBlob2(), isTaggedPDF(), f_fail_for_broken_target_structure
ReturnCode addPage ( int  aTargetPage,
double  aWidth,
double  aHeight 
)
inline

Add an empty page to the document.

This function is currently implemented for PDF documents only.

Parameters
[in]aTargetPageThe 1-based number of the page before which to insert the new page. The page will be appended if this value is 0.
[in]aWidthThe width of the page (in 1/72 inches for PDF documents).
[in]aHeightThe height of the page (in 1/72 inches for PDF documents).
Returns
ReturnCode::rc_ok iff successful.
ReturnCode addSignature ( SignDocSignatureParameters aSignatureParameters,
const SignDocVerificationParameters aVerificationParameters 
)
inline

Sign the document.

This function stores changed properties in the document before signing. If string parameter "OutputPath" is set, the signed document will be stored in a new file specified by that parameter and the original file won't be modified. If "OutputPath" is not set, the document will be written to the file from which it was loaded or to which it was most recently saved.

If a PDF document is backed by memory (most recently loaded from memory or saved to a stream) and "OutputPath" is empty, the signed document will not be saved. Use

doc.copyToStream (stream, 0);

or

doc.copyToMemory (blob, 0);

to save the signed document in that case.

If string parameter "OutputPath" is set to the special value "<memory>" for a PDF document, it will be saved to memory and signed in memory. You'll have to save the document as described in the preceding paragraph.

Some document types may allow adding signatures only if all signatures of the documents are valid.

For PDF documents, this function either signs or certifies the document, see integer parameter DocMDP.

If you are using RFC 3161 timestamps and get error ReturnCode::rc_unexpected_error with a message like "Contents overflow: xxx vs. yyy", try using a bigger value for integer parameter "TimeStampSize".

This function performs a basic verification of the signature after signing a PDF document unless siff_dont_verify_after_signing is set. This ensures that the private key matches the certificate. If that verification fails, ReturnCode::rc_invalid_signature will be returned.

Parameters
[in]aSignatureParametersThe signing parameters. The parameters can be used only once, for a single signature.
[in]aVerificationParametersVerification parameters or nullptr for default parameters. If revocation checking is enabled in aVerificationParameters, the revocation state of the certificates (subject to integer parameter "VerificationModel") in both the signing certificate's certificate chain and (if RFC 3161 time stamps are enabled) the RFC 3161 time stamp's certificate chain is checked. These verification parameters are not used for verifying the certificate chain of HTTPS connections to RFC 3161 time-stamp servers.
Returns
ReturnCode::rc_ok iff successful.
See also
copyToMemory(), copyToStream(), createSignatureParameters(), createSignatureParametersForTimeStamp(), getPathname(), setStringProperty()
ReturnCode addText ( Encoding  aEncoding,
const std::string &  aText,
int  aPage,
double  aX,
double  aY,
const std::string &  aFontName,
double  aFontSize,
const SignDocColor aTextColor,
double  aOpacity,
int  aFlags 
)
inline

Add text to a page.

This function behaves like addText2() with an empty string for aLang.

Multiple lines are not supported, the text must not contain CR and LF characters.

This function uses document (page) coordinates, see Coordinate Systems.

Note
addTextRect() is better than addText() for RTL text.
Parameters
[in]aEncodingThe encoding of aText and aFontName.
[in]aTextThe text. Complex scripts are supported, see Complex Scripts. Escape sequences must not be used.
[in]aPageThe 1-based page number of the page.
[in]aXThe X coordinate of the reference point of the visually left-most character in document coordinates.
[in]aYThe Y coordinate of the reference point of the visually left-most character in document coordinates.
[in]aFontNameThe font name. This can be the name of a standard font, the name of an already embedded font, or the name of a font defined by a font configuration file.
[in]aFontSizeThe font size (in user space units).
[in]aTextColorThe text color.
[in]aOpacityThe opacity, 0.0 (transparent) through 1.0 (opaque). Documents conforming to PDF/A-1 must use an opacity of 1.0.
[in]aFlagsMust be 0.
Returns
ReturnCode::rc_ok iff successful.
See also
addText2(), addTextRect(), addWatermark(), f_fail_for_broken_target_structure, f_require_lang, SignDocDocumentLoader::loadFontConfigBlob(), SignDocDocumentLoader::loadFontConfigEnvironment(), SignDocDocumentLoader::loadFontConfigFile(), SignDocDocumentLoader::loadFontConfigStream()
ReturnCode addText2 ( Encoding  aEncoding,
const std::string &  aText,
int  aPage,
double  aX,
double  aY,
const std::string &  aFontName,
double  aFontSize,
const SignDocColor aTextColor,
double  aOpacity,
int  aFlags,
const std::string &  aLang 
)
inline

Add text to a page (with language identifier).

Multiple lines are not supported, the text must not contain CR and LF characters.

This function uses document (page) coordinates, see Coordinate Systems.

Note
addTextRect2() is better than addText2() for RTL text.
Parameters
[in]aEncodingThe encoding of aText and aFontName.
[in]aTextThe text. Complex scripts are supported, see Complex Scripts. Escape sequences must not be used.
[in]aPageThe 1-based page number of the page.
[in]aXThe X coordinate of the reference point of the visually left-most character in document coordinates.
[in]aYThe Y coordinate of the reference point of the visually left-most character in document coordinates.
[in]aFontNameThe font name. This can be the name of a standard font, the name of an already embedded font, or the name of a font defined by a font configuration file.
[in]aFontSizeThe font size (in user space units).
[in]aTextColorThe text color.
[in]aOpacityThe opacity, 0.0 (transparent) through 1.0 (opaque). Documents conforming to PDF/A-1 must use an opacity of 1.0.
[in]aFlagsMust be 0.
[in]aLangLanguage identifier for aText, either an RFC 3066 language tag (example: "en-US") or an empty string. If a PDF/UA document does not specify a natural language, a language identifier is required. If a language identifier is required and aLang is an empty string, the behavior depends on flag f_require_lang:
  • if f_require_lang is set, this function will fail
  • if f_require_lang is not set, language tag "en" (or the language set with setDefaultDocumentLanguage()) will be used.
Returns
ReturnCode::rc_ok iff successful.
See also
addText(), addTextRect2(), addWatermark(), setDefaultDocumentLanguage(), f_fail_for_broken_target_structure, f_require_lang, SignDocDocumentLoader::loadFontConfigBlob(), SignDocDocumentLoader::loadFontConfigEnvironment(), SignDocDocumentLoader::loadFontConfigFile(), SignDocDocumentLoader::loadFontConfigStream()
ReturnCode addTextRect ( Encoding  aEncoding,
const std::string &  aText,
int  aPage,
double  aX0,
double  aY0,
double  aX1,
double  aY1,
const std::string &  aFontName,
double  aFontSize,
double  aLineSkip,
const SignDocColor aTextColor,
double  aOpacity,
HAlignment  aHAlignment,
VAlignment  aVAlignment,
int  aFlags 
)
inline

Add text in a rectangle of a page (with line breaking).

This function behaves like addTextRect2() with an empty string for aLang.

The interpretation of CR and LF in the text depends on the value of aFlags, see enum AddTextRectFlags.

This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aEncodingThe encoding of aText and aFontName.
[in]aTextThe text. The interpretation of CR and LF depends on the value of aFlags. Escape sequences must not be used.
[in]aPageThe 1-based page number of the page.
[in]aX0X coordinate of lower left corner.
[in]aY0Y coordinate of lower left corner.
[in]aX1X coordinate of upper right corner.
[in]aY1Y coordinate of upper right corner.
[in]aFontNameThe font name. This can be the name of a standard font, the name of an already embedded font, or the name of a font defined by a font configuration file.
[in]aFontSizeThe font size (in user space units).
[in]aLineSkipThe vertical distance between the baselines of successive lines (usually 1.2 * aFontSize).
[in]aTextColorThe text color.
[in]aOpacityThe opacity, 0.0 (transparent) through 1.0 (opaque). Documents conforming to PDF/A-1 must use an opacity of 1.0.
[in]aHAlignmentHorizontal alignment of the text.
[in]aVAlignmentVertical alignment of the text.
[in]aFlagsFlags modifying the behavior of this function, see enum AddTextRectFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
addText(), addTextRect2(), addWatermark(), f_fail_for_broken_target_structure, f_require_lang, SignDocDocumentLoader::loadFontConfigBlob(), SignDocDocumentLoader::loadFontConfigEnvironment(), SignDocDocumentLoader::loadFontConfigFile(), SignDocDocumentLoader::loadFontConfigStream()
ReturnCode addTextRect2 ( Encoding  aEncoding,
const std::string &  aText,
int  aPage,
double  aX0,
double  aY0,
double  aX1,
double  aY1,
const std::string &  aFontName,
double  aFontSize,
double  aLineSkip,
const SignDocColor aTextColor,
double  aOpacity,
HAlignment  aHAlignment,
VAlignment  aVAlignment,
int  aFlags,
const std::string &  aLang 
)
inline

Add text in a rectangle of a page (with line breaking and language identifier).

The interpretation of CR and LF in the text depends on the value of aFlags, see enum AddTextRectFlags.

This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aEncodingThe encoding of aText and aFontName.
[in]aTextThe text. The interpretation of CR and LF depends on the value of aFlags. Escape sequences must not be used.
[in]aPageThe 1-based page number of the page.
[in]aX0X coordinate of lower left corner.
[in]aY0Y coordinate of lower left corner.
[in]aX1X coordinate of upper right corner.
[in]aY1Y coordinate of upper right corner.
[in]aFontNameThe font name. This can be the name of a standard font, the name of an already embedded font, or the name of a font defined by a font configuration file.
[in]aFontSizeThe font size (in user space units).
[in]aLineSkipThe vertical distance between the baselines of successive lines (usually 1.2 * aFontSize).
[in]aTextColorThe text color.
[in]aOpacityThe opacity, 0.0 (transparent) through 1.0 (opaque). Documents conforming to PDF/A-1 must use an opacity of 1.0.
[in]aHAlignmentHorizontal alignment of the text.
[in]aVAlignmentVertical alignment of the text.
[in]aFlagsFlags modifying the behavior of this function, see enum AddTextRectFlags.
[in]aLangLanguage identifier for aText, either an RFC 3066 language tag (example: "en-US") or an empty string. If a PDF/UA document does not specify a natural language, a language identifier is required. If a language identifier is required and aLang is an empty string, the behavior depends on flag f_require_lang:
  • if f_require_lang is set, this function will fail
  • if f_require_lang is not set, language tag "en" (or the language set with setDefaultDocumentLanguage()) will be used.
Returns
ReturnCode::rc_ok iff successful.
See also
addText2(), addWatermark(), setDefaultDocumentLanguage(), f_fail_for_broken_target_structure, f_require_lang, SignDocDocumentLoader::loadFontConfigBlob(), SignDocDocumentLoader::loadFontConfigEnvironment(), SignDocDocumentLoader::loadFontConfigFile(), SignDocDocumentLoader::loadFontConfigStream()
ReturnCode applyFdf ( Encoding  aEncoding,
const char *  aPath,
unsigned  aFlags 
)
inline

Apply an FDF document to a PDF document.

FDF documents can be applied to PDF documents only.

Parameters
[in]aEncodingThe encoding of the string pointed to by aPath.
[in]aPathThe pathname of the FDF document. See Using SignDoc SDK in Windows Store apps for restrictions on pathnames in Windows Store apps.
[in]aFlagsFlags modifying the behavior of this function, see enum SetFieldFlags.
Returns
ReturnCode::rc_ok iff successful.
ReturnCode applyFdf ( const wchar_t *  aPath,
unsigned  aFlags 
)
inline

Apply an FDF document to a PDF document.

FDF documents can be applied to PDF documents only.

Parameters
[in]aPathThe pathname of the FDF document.
[in]aFlagsFlags modifying the behavior of this function, see enum SetFieldFlags.
Returns
ReturnCode::rc_ok iff successful.
ReturnCode changeAttachmentDescription ( Encoding  aEncoding,
const std::string &  aName,
const std::string &  aDescription 
)
inline

Change the description of an attachment of the document.

Attachments are supported for PDF documents only.

Parameters
[in]aEncodingThe encoding of aName and aDescription.
[in]aNameThe name of the attachment.
[in]aDescriptionThe new description of the attachment.
Returns
ReturnCode::rc_ok iff successful.
See also
addAttachmentBlob(), addAttachmentFile(), getAttachments(), removeAttachment()
ReturnCode checkAttachment ( Encoding  aEncoding,
const std::string &  aName,
CheckAttachmentResult aOutput 
)
inline

Check the checksum of an attachment.

Attachments are supported for PDF documents only.

Parameters
[in]aEncodingThe encoding of aName.
[in]aNameThe name of the attachment.
[out]aOutputThe result of the check will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getAttachment(), getAttachments(), getAttachmentBlob(), getAttachmentStream()
ReturnCode clearAllSignatures ( )
inline

Remove all signatures of the document.

This includes any certification signature, see removeDocMDP().

Returns
ReturnCode::rc_ok iff successful.
See also
clearApprovalSignatures(), clearSignature(), removeDocMDP()
ReturnCode clearApprovalSignatures ( )
inline

Remove all approval signatures of the document.

Note
In TIFF documents, all signatures are approval signatures.
Returns
ReturnCode::rc_ok iff successful.
See also
clearAllSignatures(), clearSignature(), removeDocMDP()
ReturnCode clearSignature ( Encoding  aEncoding,
const std::string &  aFieldName 
)
inline

Remove a signature of the document.

For some document formats (TIFF), signatures may only be cleared in the reverse order of signing (LIFO).

Parameters
[in]aEncodingThe encoding of aFieldName.
[in]aFieldNameThe name of the signature field encoded according to aEncoding.
Returns
ReturnCode::rc_ok iff successful.
See also
clearAllSignatures(), clearApprovalSignatures(), getFields(), removeDocMDP(), SignDocField::isCurrentlyClearable()
ReturnCode computeZoom ( double &  aOutput,
const SignDocRenderParameters aParams 
)
inline

Compute the zoom factor used for rendering.

If integer parameter "Height" or "Width" of aParams has been set, the actual factor depends on the document's page size. If multiple pages are selected (integer parameters "FirstPage" and "LastPage" of aParams), the maximum width and maximum height of all selected pages will be used.

See also "Scale" of SignDocRenderParameters::setNumber().

Parameters
[out]aOutputThe zoom factor will be stored here.
[in]aParamsThe parameters such as the page number and the zoom factor.
Returns
ReturnCode::rc_ok iff successful.
See also
getRenderedSize(), renderPageAsImage(), renderPageAsSignDocImage(), SignDocRenderParameters::setInteger(), SignDocRenderParameters::setNumber()
ReturnCode convCanvasPointToPagePoint ( Point aPoint,
const SignDocRenderParameters aParams 
)
inline

Convert a point expressed in canvas (image) coordinates to a point expressed in document coordinate system of the specified page.

The origin is in the bottom left corner of the page. The origin is in the upper left corner of the image. See Coordinate Systems. If multiple pages are selected (integer parameters "FirstPage" and "LastPage" of aParams), the first page of the range will be used.

Suppose the specified page of a PDF document is not rotated and has height PH and the rendered image has height IH. Then, point (0,0) will be converted to (0,PH) and point (0,IH-1) will be converted to (0,0).

Parameters
[in,out]aPointThe point to be converted.
[in]aParamsThe parameters such as the page number and the zoom factor.
Returns
ReturnCode::rc_ok iff successful.
See also
convImageRectToPageRect(), convPagePointToCanvasPoint()
ReturnCode convImageRectToPageRect ( const SignDocImageRect aInput,
Rect aOutput,
const SignDocRenderParameters aParams 
)
inline

Convert a rectangle expressed in canvas (image) coordinates to a rectangle expressed in document coordinate system of the specified page.

The origin is in the bottom left corner of the page. The origin is in the upper left corner of the image. See Coordinate Systems. If multiple pages are selected (integer parameters "FirstPage" and "LastPage" of aParams), the first page of the range will be used.

Suppose the specified page of a PDF document is not rotated and has height PH and the rendered image has height IH. Then, point (0,0) will be converted to (0,PH) and point (0,IH-1) will be converted to (0,0).

Parameters
[in]aInputThe rectangle to be converted.
[out]aOutputThe converted retangle will be stored here.
[in]aParamsThe parameters such as the page number and the zoom factor.
Returns
ReturnCode::rc_ok iff successful.
See also
convCanvasPointToPagePoint(), convPageRectToImageRect(), Rect::normalize()
ReturnCode convPagePointToCanvasPoint ( Point aPoint,
const SignDocRenderParameters aParams 
)
inline

Convert a point expressed in document coordinate system of the specified page to a point expressed in canvas (image) coordinates.

The origin is in the bottom left corner of the page. The origin is in the upper left corner of the image. See Coordinate Systems. If multiple pages are selected (integer parameters "FirstPage" and "LastPage" of aParams), the first page of the range will be used.

Suppose the specified page page of a PDF document is not rotated and has height PH and the rendered image has height IH. Then, point (0,0) will be converted to (0,IH-1) and point (0,PH) will be converted to (0,0).

Parameters
[in,out]aPointThe point to be converted.
[in]aParamsThe parameters such as the page number and the zoom factor.
Returns
ReturnCode::rc_ok iff successful.
See also
convCanvasPointToPagePoint(), convPageRectToImageRect()
ReturnCode convPageRectToImageRect ( const Rect aInput,
SignDocImageRect aOutput,
const SignDocRenderParameters aParams 
)
inline

Convert a rectangle expressed in document coordinate system of the specified page to a rectangle expressed in canvas (image) coordinates.

The origin is in the bottom left corner of the page. The origin is in the upper left corner of the image. See Coordinate Systems. If multiple pages are selected (integer parameters "FirstPage" and "LastPage" of aParams), the first page of the range will be used.

Suppose the specified page page of a PDF document is not rotated and has height PH and the rendered image has height IH. Then, point (0,0) will be converted to (0,IH-1) and point (0,PH) will be converted to (0,0).

Parameters
[in]aInputThe rectangle to be converted.
[out]aOutputThe converted retangle will be stored here.
[in]aParamsThe parameters such as the page number and the zoom factor.
Returns
ReturnCode::rc_ok iff successful.
See also
convImageRectToPageRect(), convPagePointToCanvasPoint(), SignDocImageRect::normalize()
ReturnCode copyAsSignedToMemory ( Encoding  aEncoding,
const std::string &  aFieldName,
std::vector< unsigned char > &  aBlob 
)
inline

Copy the document to a blob for viewing the document "as signed".

This function copies to a blob the document as it was when the specified signature field was signed. If the specified signature field contains the last signature applied to the document, this function is equivalent to copyToMemory(). However, for some document formats, this function may require signatures to be valid.

Parameters
[in]aEncodingThe encoding of aFieldName.
[in]aFieldNameThe name of the signature field encoded according to aEncoding.
[in,out]aBlobThe document will be copied to this blob.
Returns
ReturnCode::rc_ok iff successful.
See also
copyAsSignedToStream(), copyToMemory(), SignDocDocumentLoader::loadFromMemory()
ReturnCode copyAsSignedToStream ( Encoding  aEncoding,
const std::string &  aFieldName,
OutputStream aStream 
)
inline

Copy the document to a stream for viewing the document "as signed".

This function copies to a stream the document as it was when the specified signature field was signed. If the specified signature field contains the last signature applied to the document, this function is equivalent to copyToStream(). However, for some document formats, this function may require signatures to be valid.

Parameters
[in]aEncodingThe encoding of aFieldName.
[in]aFieldNameThe name of the signature field encoded according to aEncoding.
[in]aStreamThe document will be copied to this stream.
Returns
ReturnCode::rc_ok iff successful.
See also
copyAsSignedToMemory(), copyToStream(), SignDocDocumentLoader::loadFromMemory()
ReturnCode copyToMemory ( std::vector< unsigned char > &  aBlob,
unsigned  aFlags 
)
inline

Copy the document's current status or backing file or backing blob to a blob.

If ctsf_unsaved is not set in aFlags , this function will copy to a blob the file or blob from which the document was loaded or to which the document was most recently saved. Changes made to the in-memory copy of the document since it was loaded or saved will not be reflected in the copy written to the blob.

If ctsf_unsaved is set in aFlags, unsaved changes made to the in-memory copy of the document will be included (as incremental update for PDF documents) in the blob.

This function does not have side effects on the in-memory copy of the document, that is, unsaved changes remain unsaved (except for being saved to the blob if ctsf_unsaved is set in aFlags).

Parameters
[in,out]aBlobThe document will be copied to this blob.
[in]aFlagsFlags modifying the behavior of this function, see enum CopyToStreamFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
copyAsSignedToMemory(), copyToStream(), saveToFile(), saveToMemory(), saveToStream(), SignDocDocumentLoader::loadFromFile(), SignDocDocumentLoader::loadFromMemory()
ReturnCode copyToStream ( OutputStream aStream,
unsigned  aFlags 
)
inline

Copy the document's current status or backing file or backing blob to a stream.

If ctsf_unsaved is not set in aFlags , this function will copy to a stream the file or blob from which the document was loaded or to which the document was most recently saved. Changes made to the in-memory copy of the document since it was loaded or saved will not be reflected in the copy written to the stream.

If ctsf_unsaved is set in aFlags, unsaved changes made to the in-memory copy of the document will be included (as incremental update for PDF documents) in the stream.

This function does not have side effects on the in-memory copy of the document, that is, unsaved changes remain unsaved (except for being saved to the stream if ctsf_unsaved is set in aFlags).

Parameters
[in]aStreamThe document will be copied to this stream.
[in]aFlagsFlags modifying the behavior of this function, see enum CopyToStreamFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
copyAsSignedToStream(), copyToMemory(), saveToFile(), saveToMemory(), saveToStream(), SignDocDocumentLoader::loadFromFile(), SignDocDocumentLoader::loadFromMemory()
SignDocAnnotation * createFreeTextAnnotation ( const Point aLowerLeft,
const Point aUpperRight 
)
inline

Create a text annotation.

See SignDocAnnotation for details. This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aLowerLeftcoordinates of lower left corner.
[in]aUpperRightcoordinates of upper right corner.
Returns
The new annotation object. The caller is responsible for destroying the object after use.
See also
addAnnotation()
SignDocAnnotation * createFreeTextAnnotation ( double  aX0,
double  aY0,
double  aX1,
double  aY1 
)
inline

Create a text annotation.

See SignDocAnnotation for details. This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aX0X coordinate of lower left corner.
[in]aY0Y coordinate of lower left corner.
[in]aX1X coordinate of upper right corner.
[in]aY1Y coordinate of upper right corner.
Returns
The new annotation object. The caller is responsible for destroying the object after use.
See also
addAnnotation()
SignDocAnnotation * createLineAnnotation ( const Point aStart,
const Point aEnd 
)
inline

Create a line annotation.

See SignDocAnnotation for details.

This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aStartStart point.
[in]aEndEnd point.
Returns
The new annotation object. The caller is responsible for destroying the object after use.
See also
addAnnotation()
SignDocAnnotation * createLineAnnotation ( double  aStartX,
double  aStartY,
double  aEndX,
double  aEndY 
)
inline

Create a line annotation.

See SignDocAnnotation for details. This function uses document (page) coordinates, see Coordinate Systems.

Parameters
[in]aStartXX coordinate of start point.
[in]aStartYY coordinate of start point.
[in]aEndXX coordinate of end point.
[in]aEndYY coordinate of end point.
Returns
The new annotation object. The caller is responsible for destroying the object after use.
See also
addAnnotation()
SignDocAnnotation * createScribbleAnnotation ( )
inline

Create a scribble annotation.

See SignDocAnnotation for details. This function uses document (page) coordinates, see Coordinate Systems.

Returns
The new annotation object. The caller is responsible for destroying the object after use.
See also
addAnnotation(), SignDocAnnotation::addPoint(), SignDocAnnotation::newStroke()
ReturnCode createSignatureParameters ( Encoding  aEncoding,
const std::string &  aFieldName,
const std::string &  aProfile,
std::unique_ptr< SignDocSignatureParameters > &  aOutput 
)
inline

Create a SignDocSignatureParameters object for signing a signature field.

The caller is responsible for destroying the object.

Each SignDocSignatureParameters object should be used for at most one signature.

The following profiles are available and documented:

ProfileDocument TypesDescription
"" PDF, TIFF Image above Signer and SignTime
"image" PDF, TIFF Image only

For TIFF documents, "" produces the same output as "image".

Profile "" is defined by this template:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SignatureTemplate SYSTEM "SignatureTemplate.dtd">
<SignatureTemplate
    text-halignment="center"
    text-valignment="bottom"
    image-halignment="center"
    image-valignment="top"
    image-transparency="brightest"
    text-position="below"
    font-size="0.1 h"
    text-hmargin="0.1 h"
    image-margin="1">
  <Line item="Signer"/>
  <Line item="SignTime"/>
</SignatureTemplate>

Profile "image" is defined by this template:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SignatureTemplate SYSTEM "SignatureTemplate.dtd">
<SignatureTemplate
    text-halignment="center"
    text-valignment="center"
    image-halignment="center"
    image-valignment="center"
    image-transparency="brightest"
    text-position="overlay"
    font-size="0.1 h"
    text-hmargin="0.1 h"
    image-margin="1">
</SignatureTemplate>
Parameters
[in]aEncodingThe encoding of aFieldName.
[in]aFieldNameThe name of the signature field, encoded according to aEncoding.
[in]aProfileThe profile name (ASCII). Some document types and signature fields support different sets of default parameters. The default profile, "", is supported for all signature fields.
[out]aOutputA pointer to the new parameters object will be stored here. The caller is responsible for destroying the object.
Returns
ReturnCode::rc_ok iff successful.
See also
addSignature(), createSignatureParametersForTimeStamp(), getProfiles()
ReturnCode createSignatureParameters ( const wchar_t *  aFieldName,
const wchar_t *  aProfile,
std::unique_ptr< SignDocSignatureParameters > &  aOutput 
)
inline

Create a SignDocSignatureParameters object for signing a signature field.

The caller is responsible for destroying the object.

Each SignDocSignatureParameters object should be used for at most one signature.

The following profiles are available and documented:

ProfileDocument TypesDescription
"" PDF, TIFF Image above Signer and SignTime
"image" PDF, TIFF Image only

For TIFF documents, "" produces the same output as "image".

Profile "" is defined by this template:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SignatureTemplate SYSTEM "SignatureTemplate.dtd">
<SignatureTemplate
    text-halignment="center"
    text-valignment="bottom"
    image-halignment="center"
    image-valignment="top"
    image-transparency="brightest"
    text-position="below"
    font-size="0.1 h"
    text-hmargin="0.1 h"
    image-margin="1">
  <Line item="Signer"/>
  <Line item="SignTime"/>
</SignatureTemplate>

Profile "image" is defined by this template:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SignatureTemplate SYSTEM "SignatureTemplate.dtd">
<SignatureTemplate
    text-halignment="center"
    text-valignment="center"
    image-halignment="center"
    image-valignment="center"
    image-transparency="brightest"
    text-position="overlay"
    font-size="0.1 h"
    text-hmargin="0.1 h"
    image-margin="1">
</SignatureTemplate>
Parameters
[in]aFieldNameThe name of the signature field.
[in]aProfileThe profile name (ASCII). Some document types and signature fields support different sets of default parameters. The default profile, "", is supported for all signature fields.
[out]aOutputA pointer to the new parameters object will be stored here. The caller is responsible for destroying the object.
Returns
ReturnCode::rc_ok iff successful.
See also
addSignature(), createSignatureParametersForTimeStamp(), getProfiles()
ReturnCode createSignatureParametersForTimeStamp ( std::unique_ptr< SignDocSignatureParameters > &  aOutput)
inline

Create a SignDocSignatureParameters object for adding a document time stamp.

The caller is responsible for destroying the object.

Each SignDocSignatureParameters object should be used for at most one signature.

This function is available for PDF documents only.

Parameters
[out]aOutputA pointer to the new parameters object will be stored here. The caller is responsible for destroying the object.
Returns
ReturnCode::rc_ok iff successful.
See also
addSignature(), createSignatureParameters()
ReturnCode createTextIterator ( int  aFirstPage,
int  aLastPage,
int  aFlags,
std::unique_ptr< SignDocTextIterator > &  aOutput 
)
inline

Create an iterator that visits all the text of a range of pages.

Text will be returned in the sequence encountered when reading the content streams of the document sequentially.

This function is implemented for PDF documents only.

Parameters
[in]aFirstPage1-based number of first page to be visited.
[in]aLastPage1-based number of last page to be visited or 0 for all pages to the end of the document.
[in]aFlagsFlags modifying the behavior of this function, must be 0.
[out]aOutputThe new text iterator object.
Returns
ReturnCode::rc_ok iff successful.
See also
findText()
ReturnCode exportFields ( OutputStream aStream,
int  aFlags 
)
inline

Export all fields as XML to a stream.

This function always uses UTF-8 encoding. The output conforms to schema PdfFields.xsd.

There is a setFlags() flag modifying the behavior of this function: f_ambiguous_button_value_empty.

Parameters
[in]aStreamThe fields will be saved to this stream.
[in]aFlagsFlags modifying the behavior of this function, See enum ExportFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
exportFieldsToMemory(), getFields(), setField()
ReturnCode exportFieldsToMemory ( std::vector< unsigned char > &  aOutput,
int  aFlags 
)
inline

Export all fields as XML to a blob.

This function always uses UTF-8 encoding. The output conforms to schema PdfFields.xsd.

There is a setFlags() flag modifying the behavior of this function: f_ambiguous_button_value_empty.

Parameters
[out]aOutputThe XML document will be stored here.
[in]aFlagsFlags modifying the behavior of this function, See enum ExportFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
exportFieldsToMemory(), getFields(), setField()
ReturnCode exportProperties ( const std::string &  aCollection,
OutputStream aStream,
int  aFlags 
)
inline

Export properties as XML to a stream.

This function always uses UTF-8 encoding. The output conforms to schema AllSignDocProperties.xsd (if aCollection is empty) or SignDocProperties.xsd (if aCollection is non-empty).

Parameters
[in]aCollectionThe name of the collection, see getProperties(). If the string is empty, all properties of the "public" and "encrypted" collections will be exported.
[in]aStreamThe properties will be saved to this stream.
[in]aFlagsFlags modifying the behavior of this function, See enum ExportFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
exportPropertiesToMemory(), importProperties(), importPropertiesFromMemory()
ReturnCode exportPropertiesToMemory ( const std::string &  aCollection,
std::vector< unsigned char > &  aBlob,
int  aFlags 
)
inline

Export properties as XML to a blob.

This function always uses UTF-8 encoding. The output conforms to schema AllSignDocProperties.xsd (if aCollection is empty) or SignDocProperties.xsd (if aCollection is non-empty).

Parameters
[in]aCollectionThe name of the collection, see getProperties(). If the string is empty, all properties of the "public" and "encrypted" collections will be exported.
[out]aBlobThe XML document will be stored here.
[in]aFlagsFlags modifying the behavior of this function, See enum ExportFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
exportProperties(), importProperties(), importPropertiesFromMemory()
ReturnCode findText ( Encoding  aEncoding,
int  aFirstPage,
int  aLastPage,
const std::string &  aText,
int  aFlags,
std::vector< SignDocFindTextOccurrence > &  aOutput 
)
inline

Find text.

The text of the document will be scanned in the sequence encountered when reading the content streams of the document sequentially.

This function is implemented for PDF documents only.

Parameters
[in]aEncodingThe encoding of aText.
[in]aFirstPage1-based number of first page to be searched.
[in]aLastPage1-based number of last page to be searched or 0 to search to the end of the document.
[in]aTextText to be searched for. Multiple successive spaces are treated as single space (and may be ignored subject to aFlags).
[in]aFlagsFlags modifying the behavior of this function, see enum FindTextFlags.
[out]aOutputInformation about the found text.
Returns
ReturnCode::rc_ok on success (even if the text was not found).
See also
createTextIterator()
ReturnCode flattenAnnotations ( int  aFirstPage,
int  aLastPage,
unsigned  aFlags 
)
inline

Flatten all annotations of the document or of a range of pages.

Flattening an annotation of a PDF document makes its appearance part of the page and removes the selected annotation or all annotations. This function selects all non-widget annotations on the specified pages, ie, it does not flatten fields.

Flattening annotations breaks existing signatures. If you are flattening annotations only for printing with PDF components that don't support annotations, make a copy of the document, pass

to setShootInFoot(), flatten the annotations, print the document, and throw it away.

Parameters
[in]aFirstPage1-based number of first page.
[in]aLastPage1-based number of last page or 0 to process all pages to the end of the document.
[in]aFlagsFlags modifying the behavior of this function, see FlattenAnnotationsFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
flattenFields(), removeAnnotation()
ReturnCode flattenField ( Encoding  aEncoding,
const std::string &  aName,
int  aWidget 
)
inline

Flatten a field.

Flattening a field of a PDF document makes its appearance part of the page and removes the selected widget or all widgets; the field will be removed when all its widgets have been flattened.

Flattening unsigned signature fields does not work correctly.

Flattening fields breaks existing signatures. If you are flattening fields only for printing with PDF components that don't support annotations, make a copy of the document, pass

to setShootInFoot(), flatten the fields, print the document, and throw it away.

Parameters
[in]aEncodingThe encoding of aName.
[in]aNameThe fully-qualified name of the field.
[in]aWidgetThe widget index to flatten only one widget or -1 to flatten all widgets.
Returns
ReturnCode::rc_ok iff successful.
See also
flattenFields(), removeField()
ReturnCode flattenFields ( int  aFirstPage,
int  aLastPage,
unsigned  aFlags 
)
inline

Flatten all fields of the document or of a range of pages.

Flattening a field of a PDF document makes its appearance part of the page and removes the selected widget or all widgets; the field will be removed when all its widgets have been flattened. This function selects all widgets on the specified pages.

Flattening unsigned signature fields does not work correctly.

Flattening fields breaks existing signatures. If you are flattening fields only for printing with PDF components that don't support annotations, make a copy of the document, pass

to setShootInFoot(), flatten the fields, print the document, and throw it away.

Parameters
[in]aFirstPage1-based number of first page.
[in]aLastPage1-based number of last page or 0 to process all pages to the end of the document.
[in]aFlagsFlags modifying the behavior of this function, see FlattenFieldsFlags. If this value is 0, signature fields and hidden/invisible widgets will not be flattened.
Returns
ReturnCode::rc_ok iff successful.
See also
flattenAnnotations(), flattenField(), removeField()
ReturnCode getAnnotation ( Encoding  aEncoding,
int  aPage,
const std::string &  aName,
std::unique_ptr< SignDocAnnotation > &  aOutput 
)
inline

Get a named annotation of a page.

All setters will fail for the returned object.

Parameters
[in]aEncodingThe encoding of aName.
[in]aPageThe page number (1 for the first page).
[in]aNameThe name of the annotation.
[out]aOutputA pointer to a new SignDocAnnotation object or nullptr will be stored here. The caller is responsible for destroying that object.
Returns
ReturnCode::rc_ok iff successful.
See also
getAnnotations()
ReturnCode getAnnotations ( Encoding  aEncoding,
int  aPage,
std::vector< std::string > &  aOutput 
)
inline

Get a list of all named annotations of a page.

Unnamed annotations are ignored by this function.

Parameters
[in]aEncodingThe encoding to be used for the names of the annotations returned in aOutput.
[in]aPageThe page number (1 for the first page).
[out]aOutputThe names of the annotations will be stored here. The order is currently unspecified, a future implementation may return the annotations in tab order.
Returns
ReturnCode::rc_ok iff successful.
See also
addAnnotation(), getAnnotation(), removeAnnotation(), SignDocAnnotation::setName()
ReturnCode getAttachment ( Encoding  aEncoding,
const std::string &  aName,
SignDocAttachment aOutput 
)
inline

Get information about an attachment.

Attachments are supported for PDF documents only.

Parameters
[in]aEncodingThe encoding of aName.
[in]aNameThe name of the attachment.
[out]aOutputInformation about the attachment will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
checkAttachment(), getAttachments(), getAttachmentBlob(), getAttachmentStream()
ReturnCode getAttachmentBlob ( Encoding  aEncoding,
const std::string &  aName,
std::vector< unsigned char > &  aOutput 
)
inline

Get an attachment as blob.

Attachments are supported for PDF documents only.

Parameters
[in]aEncodingThe encoding of aName.
[in]aNameThe name of the attachment.
[out]aOutputThe attachment will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
checkAttachment(), getAttachments(), getAttachmentStream()
ReturnCode getAttachments ( Encoding  aEncoding,
std::vector< std::string > &  aOutput 
)
inline

Get a list of all attachments of the document.

Attachments are supported for PDF documents only.

Parameters
[in]aEncodingThe encoding to be used for the names returned in aOutput.
[out]aOutputThe names of the document's attachments will be stored here. Use getAttachment() to get information for a single attachment.
Returns
ReturnCode::rc_ok iff successful.
See also
checkAttachment(), getAttachment(), getAttachmentBlob(), getAttachmentStream()
ReturnCode getAttachmentStream ( Encoding  aEncoding,
const std::string &  aName,
std::unique_ptr< InputStream > &  aOutput 
)
inline

Get an InputStream for an attachment.

Attachments are supported for PDF documents only.

Parameters
[in]aEncodingThe encoding of aName.
[in]aNameThe name of the attachment.
[out]aOutputA pointer to a new InputStream object will be stored here; the caller is responsible for deleting that object after use. The InputStream does not support seek(), tell(), and avail().
Returns
ReturnCode::rc_ok iff successful.
See also
checkAttachment(), getAttachments(), getAttachmentBlob()
int getAvailableMethods ( )
inline

Get a bitset indicating which signing methods are available for this document.

This document's signature fields offer a subset of the signing methods returned by this function.

Returns
1<<SignDocSignatureParameters::m_digsig_pkcs1 etc.
See also
SignDocSignatureParameters::getAvailableMethods()
ReturnCode getBitsPerPixel ( int  aPage,
int &  aBPP 
)
inline

Get the number of bits per pixel (TIFF only).

Different pages of the document may have different numbers of bits per pixel.

Parameters
[in]aPageThe page number (1 for the first page).
[out]aBPPThe number of bits per pixel of the page (1, 8, 24, or 32) or 0 (for PDF documents) will be stored here.
Returns
ReturnCode::rc_ok if successful, ReturnCode::rc_invalid_argument if aPage is out of range.
ReturnCode getBooleanProperty ( Encoding  aEncoding,
const std::string &  aCollection,
const std::string &  aName,
bool &  aValue 
)
inline

Get the value of a SignDoc property (boolean).

In the "public" and "encrypted" collections, property names are compared under Unicode simple case folding, that is, lower case and upper case is not distinguished.

Parameters
[in]aEncodingThe encoding of aName.
[in]aCollectionThe name of the collection, see getProperties().
[in]aNameThe name of the property.
[out]aValueThe value will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getIntegerProperty(), getProperties(), getStringProperty()
ReturnCode getConversionFactors ( int  aPage,
double &  aFactorX,
double &  aFactorY 
)
inline

Get the conversion factors for a page.

Different pages of the document may have different conversion factors. For TIFF documents, this function yields the same values as getResolution(). For PDF documents, this function now always stores 72 to aFactorX and aFactorY as UserUnit is taken into account automatically. See Coordinate Systems.

Parameters
[in]aPageThe page number (1 for the first page).
[out]aFactorXDivide horizontal coordinates by this number to convert document coordinates to inches. The value will be 0.0 if the conversion factor is not available.
[out]aFactorYDivide vertical coordinates by this number to convert document coordinates to inches. The value will be 0.0 if the conversion factor is not available.
Returns
ReturnCode::rc_ok iff successful.
See also
getPageSize(), getResolution()
int getDocMDP ( ) const
inline

Get the DocMDP P value of the document's certification signature.

The DocMDP P value of the certification signature specifies what modifications to the document are allowed.

This function does not verify the certification signature.

Returns
-1 if there is no certification signature, 1 if no modifications are allowed, 2 if only filling in forms, instantiating page templates, and signing are permitted, 3 if only filling in forms, instantiating page templates, signing, creating annotations, deleting annotations, and modifying annotations are permitted. For TIFF documents, this function always returns -1.
See also
getLockMDP()
std::string getDocumentLanguage ( Encoding  aEncoding) const
inline

Get the document's natural language.

That language applies to all text unless overridden locally.

This function throws std::runtime_error if the natural language cannot be represented using the specified encoding (which can happen for invalid documents only).

Parameters
[in]aEncodingThe encoding to be used for the return value.
Returns
The natural language of the document as RFC 3066 language tag. Example: "en-US". If the document does not specify a natural language, an empty string will be returned.
See also
setDocumentLanguage(), f_require_alternate_field_name, f_require_lang
const char * getErrorMessage ( Encoding  aEncoding) const
inline

Get an error message for the last function call.

Parameters
[in]aEncodingThe encoding to be used for the error message.
Returns
A pointer to a string describing the reason for the failure of the last function call. The string is empty if the last call succeeded. The pointer is valid until this object is destroyed or a member function of this object is called.
See also
getErrorMessageW()
const wchar_t * getErrorMessageW ( ) const
inline

Get an error message for the last function call.

Returns
A pointer to a string describing the reason for the failure of the last function call. The string is empty if the last call succeeded. The pointer is valid until this object is destroyed or a member function of this object is called.
See also
getErrorMessage()
ReturnCode getField ( Encoding  aEncoding,
const std::string &  aName,
SignDocField aOutput 
)
inline

Get an interactive field by name.

There is a setFlags() flag modifying the behavior of this function: f_ambiguous_button_value_empty.

Parameters
[in]aEncodingThe encoding of aName.
[in]aNameThe fully-qualified name of the field.
[out]aOutputThe field will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getFields(), setField()
ReturnCode getFields ( int  aTypes,
std::vector< SignDocField > &  aOutput 
)
inline

Get all interactive fields of the specified types.

There is a setFlags() flag modifying the behavior of this function: f_ambiguous_button_value_empty.

Parameters
[in]aTypes0 to get fields of all types. Otherwise, a bitset selecting the field types to be included. To include a field of type t, add 1<<t, where t is a value of SignDocField::Type.
[out]aOutputThe fields will be stored here. They appear in the order in which they have been defined.
Returns
ReturnCode::rc_ok iff successful.
See also
exportFields(), exportFieldsToMemory(), getField(), getFieldsOfPage()
ReturnCode getFieldsOfPage ( int  aPage,
int  aTypes,
std::vector< SignDocField > &  aOutput 
)
inline

Get all interactive fields of the specified page, in tab order.

If the document does not specify a tab order, the fields will be returned in widget order.

There is a setFlags() flag modifying the behavior of this function: f_ambiguous_button_value_empty.

Note
Structure order (S) is not yet supported. If the page specifies structure order, the fields will be returned in widget order.
Parameters
[in]aPageThe 1-based page number.
[in]aTypes0 to get fields of all types. Otherwise, a bitset selecting the field types to be included. To include a field of type t, add 1<<t, where t is a value of SignDocField::Type.
[out]aOutputThe fields will be stored here in tab order. There will be one element per widget (rather than per field); use SignDocField::getWidget() to find out which widget of the field is referenced.
Returns
ReturnCode::rc_ok iff successful.
See also
exportFields(), exportFieldsToMemory(), getField(), getFields()
unsigned getFlags ( ) const
inline

Get the flags set by setFlags().

Returns
The flags currently in force.
See also
setFlags()
SIGNDOC_Document* getImpl ( )
inline

Internal function.

const SIGNDOC_Document* getImpl ( ) const
inline

Internal function.

ReturnCode getIntegerProperty ( Encoding  aEncoding,
const std::string &  aCollection,
const std::string &  aName,
int &  aValue 
)
inline

Get the value of a SignDoc property (integer).

In the "public" and "encrypted" collections, property names are compared under Unicode simple case folding, that is, lower case and upper case is not distinguished.

Parameters
[in]aEncodingThe encoding of aName.
[in]aCollectionThe name of the collection, see getProperties().
[in]aNameThe name of the property.
[out]aValueThe value will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getBooleanProperty(), getProperties(), getStringProperty()
ReturnCode getLastTimestamp ( std::string &  aTime)
inline

Get the timestamp used by the last successful call of addSignature().

This function may return a timestamp even if the last call of addSignature() was not successful. See also string parameters "Timestamp" and "TimeStampServerURL" of SignDocSignatureParameters.

Parameters
[out]aTimeThe timestamp in ISO 8601 format (yyyy-mm-ddThh:mm:ss without milliseconds, with optional timezone (or an empty string if there is no timestamp available) will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
addSignature(), getSignatureString(), SignDocSignatureParameters::setString()
int getLockMDP ( ) const
inline

Get the lowest lock MDP value of the signed signature fields.

The lock MDP value specifies what modifications to the document are allowed.

This function does not verify any signature.

Returns
-1 if there is no signature field with lock MDP value, 1 if no modifications are allowed, 2 if only filling in forms, instantiating page templates, and signing are permitted, 3 if only filling in forms, instantiating page templates, signing, creating annotations, deleting annotations, and modifying annotations are permitted. For TIFF documents, this function always returns -1.
See also
getDocMDP()
int getPageCount ( ) const
inline

Get the number of pages.

Returns
The number of pages.
See also
getPageLabel()
ReturnCode getPageLabel ( int  aPage,
std::string &  aOutput 
)
inline

Get the page label for a page number.

For TIFF documents, aPage will be converted to a decimal number.

Parameters
[in]aPageThe page number (1 for the first page).
[out]aOutputThe page label will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getPageCount()
ReturnCode getPageSize ( int  aPage,
double &  aWidth,
double &  aHeight 
)
inline

Get the size of a page.

Different pages of the document may have different sizes.

Parameters
[in]aPageThe page number (1 for the first page).
[out]aWidthThe width of the page (in document coordinates) will be stored here.
[out]aHeightThe height of the page (in document coordinates) will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getConversionFactors()
ReturnCode getPathname ( Encoding  aEncoding,
std::string &  aPath 
)
inline

Get the current pathname of the document.

The pathname will be empty if the document is stored in memory (ie, if it has been loaded from memory or saved to a stream).

If a FDF document has been opened, this function will return the pathname of the referenced PDF file.

Parameters
[in]aEncodingThe encoding to be used for aPath.
[out]aPathThe pathname will be stored here.
Returns
ReturnCode::rc_ok iff successful.
ReturnCode getProfiles ( Encoding  aEncoding,
const std::string &  aFieldName,
std::vector< std::string > &  aOutput 
)
inline

Get a list of profiles for a signature field.

Parameters
[in]aEncodingThe encoding of aFieldName.
[in]aFieldNameThe name of the signature field encoded according to aEncoding.
[out]aOutputThe names (ASCII) of all profiles supported by the signature field will be stored here, excluding the default profile "" which is always available.
Returns
ReturnCode::rc_ok iff successful.
See also
createSignatureParameters()
ReturnCode getProperties ( const std::string &  aCollection,
std::vector< SignDocProperty > &  aOutput 
)
inline

Get the names and types of all SignDoc properties of a certain collection of properties of the document.

Use getBooleanProperty(), getIntegerProperty(), or getStringProperty() to get the values of the properties.

There are three collections of SignDoc document properties:

  • "encrypted" Encrypted properties. Names and values are symmetrically encrypted.
  • "public" Public properties. Document viewer applications may be able to display or let the user modify these properties.
  • "pdfa" PDF/A properties (PDF documents only):
    • part (PDF/A version identifier: 1, 2, or 3)
    • amd (optional PDF/A amendment identifier)
    • conformance (PDF/A conformance level: A, B, or U)
    All properties in this collection have string values, the property names are case-sensitive. If the "part" property is present, the document claims to be conforming to PDF/A. Your application may change its behavior when dealing with PDF/A documents. For instance, it might want to avoid transparency.
  • "pdfua" PDF/UA properties (PDF documents only):
    • part (PDF/UA version identifier: 1)
    • amd (optional PDF/UA amendment identifier)
    • corr (optional PDF/UA corrigenda identifier)
    All properties in this collection have string values, the property names are case-sensitive. If the "part" property is present, the document claims to be conforming to PDF/UA. Your application may change its behavior when dealing with PDF/UA documents.

Using the same property name in the "encrypted" and "public" collections is not possible. Attempts to get, set, or remove a property in the wrong collection will fail with error code ReturnCode::rc_wrong_collection. To move a property from one collection to another collection, first remove it from the source collection, then add it to the target collection.

The "pdfa" and "pdfua" collections are read-only and a property name existing in those collections does not prevent that property name from appearing in one of the other collections.

The syntax of property names depends on the document type and the collection containing the property.

"public" properties of PDF documents are stored according to XMP in namespace "http://www.softpro.de/pdfa/signdoc/public/", therefore property names must be valid unqualified XML names, see the syntax of "Name" in the XML 1.1 specification at http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-common-syn (section 2.3 Common Syntactic Constructs).

For "encrypted" properties and any properties in TIFF documents, property names can contain arbitrary Unicode characters except for NUL.

Parameters
[in]aCollectionThe name of the collection, see above.
[out]aOutputThe properties will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getStringProperty(), isTaggedPDF(), removeProperty()
ReturnCode getRenderedSize ( SignDocRenderOutput aOutput,
const SignDocRenderParameters aRenderParameters 
)
inline

Get the size of the rendered page in pixels (without actually rendering it).

The returned values may be approximations for some document formats. If multiple pages are selected (integer parameters "FirstPage" and "LastPage" of aParams), the maximum width and maximum height of all selected pages will be used.

Parameters
[out]aOutputThe width and height of the image that would be computed by renderPageAsImage() and renderPageAsSignDocImage() with aClipRect being nullptr will be stored here.
[in]aRenderParametersParameters such as the page number.
Returns
ReturnCode::rc_ok iff successful.
See also
renderPageAsImage(), renderPageAsSignDocImage()
ReturnCode getRequiredSaveToFileFlags ( int &  aOutput)
inline

Get all flags currently required for saveToFile().

This function currently stores sf_incremental (saving the document non-incrementally would destroy existing signatures) or 0 (the document may be saved non-incrementally) to aOutput.

Parameters
[out]aOutputThe flags will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getSaveToFileFlags(), getSaveToStreamFlags(), saveToFile()
ReturnCode getResolution ( int  aPage,
double &  aResX,
double &  aResY 
)
inline

Get the resolution of a page.

Different pages of the document may have different resolutions. Use getConversionFactors() to get factors for converting document coordinates to real world coordinates. See Coordinate Systems.

Parameters
[in]aPageThe page number (1 for the first page).
[out]aResXThe horizontal resolution in DPI will be stored here. The value will be 0.0 if the resolution is not available.
[out]aResYThe vertical resolution in DPI will be stored here. The value will be 0.0 if the resolution is not available.
Returns
ReturnCode::rc_ok iff successful.
See also
getConversionFactors()
ReturnCode getSaveToFileFlags ( int &  aOutput)
inline

Get all flags currently valid for saveToFile().

Note that sf_incremental cannot be used together with sf_linearized even if all these flags are returned by this function. sf_pdfa_buttons is returned only if the document claims PDF/A-1 conformance.

Parameters
[out]aOutputThe flags will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getRequiredSaveToFileFlags(), getSaveToStreamFlags(), saveToFile()
ReturnCode getSaveToStreamFlags ( int &  aOutput)
inline

Get all flags currently valid for saveToStream() and saveToMemory().

Note that sf_incremental cannot be used together with sf_linearized even if all these flags are returned by this function. sf_pdfa_buttons is returned only if the document claims PDF/A-1 conformance.

Parameters
[out]aOutputThe flags will be stored here.
Returns
ReturnCode::rc_ok iff successful.
See also
getSaveToFileFlags(), saveToMemory(), saveToStream()
unsigned getShootInFoot ( ) const
inline

Get the flags set by setShootInFoot().

Returns
The flags currently in force.
See also
setShootInFoot()
ReturnCode getSignature ( int  aIndex,
std::unique_ptr< SignDocSignature > &  aOutput 
)
inline

Get a signature of the document.

By passing values for aIndex from 0 up to getSignatureCount()-1, the history of changes to the document can be obtained. Exception: If clearSignature() has been called for a TIFF document, the order of signatures is indeterminate.

Parameters
[in]aIndexThe index of the signature, 0 for the first signature applied to the document, getSignatureCount()-1 for the newest signature.
[out]aOutputA pointer to a new SignDocSignature object or nullptr will be stored here. The caller is responsible for destroying that object.
Returns
ReturnCode::rc_ok iff successful.
See also
getSignatureCount(), verifySignature(), verifySignature2()
int getSignatureCount ( )
inline

Get the number of signatures that can be retrieved with getSignature().

Returns
The number of signatures, possibly including removed signatures.
See also
getSignature()
SPPDF_Document * getSPPDFDocument ( bool  aDestroy)
inline

Get the underlying SPPDF_Document object.

Note
Please be careful to not interfere with SignDoc SDK operation.
Parameters
[in]aDestroyfalse to let this SignDocDocument object live, true to destroy this SignDocDocument object.
Returns
A pointer to the underlying SPPDF_Document object or nullptr if the document is not a PDF document. If aDestroy is false, do not destroy the SPPDF_Document object; the SPPDF_Document object is valid until this SignDocDocument object is destroyed. If aDestroy is true and the return value is not nullptr, you must no longer use this SigndDocDocument object and you must destroy the SPPDF_Document object after use.
See also
~SignDocDocument()
ReturnCode getStringProperty ( Encoding  aEncoding,
const std::string &  aCollection,
const std::string &  aName,
std::string &  aValue 
)
inline

Get the value of a SignDoc property (string).

In the "public" and "encrypted" collections, property names are compared under Unicode simple case folding, that is, lower case and upper case is not distinguished.

Parameters
[in]aEncodingThe encoding of aName and for aValue.
[in]aCollectionThe name of the collection, see getProperties().
[in]aNameThe name of the property.
[out]aValueThe value will be stored here, encoded according to aEncoding.
Returns
ReturnCode::rc_ok iff successful.
See also
getBooleanPropery(), getIntegerProperty(), getProperties()
ReturnCode getTextFieldAttributes ( SignDocTextFieldAttributes aOutput)
inline

Get the document's default text field attributes.

Parameters
[in,out]aOutputThis object will be updated.
Returns
ReturnCode::rc_ok iff successful.
See also
getField(), setTextFieldAttributes(), SignDocField::getTextFieldAttributes()
SignDocDocument::DocumentType getType ( ) const
inline

Get the type of the document.

Returns
The document type.
ReturnCode importPageFromImageBlob ( int  aTargetPage,
const unsigned char *  aPtr,
size_t  aSize,
double  aZoom,
double  aWidth,
double  aHeight,
int  aFlags 
)
inline

Import a page from a blob containing an image.

This function behaves like importPageFromImageBlob2() with an empty string for aDescription, that is, if the document uses Tagged PDF, a dummy alternate description for the image ("image" with language code "en") will provided to avoid breaking standard compliance. It is strongly recommended to use importPageFromImageBlob2() with a meaningful description of the image.

This function is currently implemented for PDF documents only.

Parameters
[in]aTargetPageThe 1-based number of the page before which to insert the new page. The page will be appended if this value is 0.
[in]aPtrPointer to the first octet of the blob containing the image. Supported formats for inserting into PDF documents are: JPEG, PNG, GIF, TIFF, and BMP.
[in]aSizeSize (in octets) of the blob pointed to by aPtr.
[in]aZoomZoom factor or zero. If this argument is non-zero, aWidth and aHeight must be zero. The size of the page is computed from the image size and resolution, multiplied by aZoom.
[in]aWidthPage width (document coordinates) or zero. If this argument is non-zero, aHeight must also be non-zero and aZoom must be zero. The image will be scaled to this width.
[in]aHeightPage height (document coordinates) or zero. If this argument is non-zero, aWidth must also be non-zero and aZoom must be zero. The image will be scaled to this height.
[in]aFlagsFlags modifying the behavior of this function, See enum ImportImageFlags. ii_keep_aspect_ratio is not needed if aZoom is non-zero.
Returns
ReturnCode::rc_ok iff successful.
See also
addImageFromMemory(), addImageFromMemory2(), importPageFromImageBlob2(), importPageFromImageFile(), importPageFromImageFile2(), isTaggedPDF(), f_fail_for_broken_target_structure
ReturnCode importPageFromImageBlob2 ( int  aTargetPage,
const unsigned char *  aPtr,
size_t  aSize,
double  aZoom,
double  aWidth,
double  aHeight,
int  aFlags,
Encoding  aEncoding,
const std::string &  aDescription,
const std::string &  aLang 
)
inline

Import a page from a blob containing an image (with alternate description).

This function is currently implemented for PDF documents only.

Parameters
[in]aTargetPageThe 1-based number of the page before which to insert the new page. The page will be appended if this value is 0.
[in]aPtrPointer to the first octet of the blob containing the image. Supported formats for inserting into PDF documents are: JPEG, PNG, GIF, TIFF, and BMP.
[in]aSizeSize (in octets) of the blob pointed to by aPtr.
[in]aZoomZoom factor or zero. If this argument is non-zero, aWidth and aHeight must be zero. The size of the page is computed from the image size and resolution, multiplied by aZoom.
[in]aWidthPage width (document coordinates) or zero. If this argument is non-zero, aHeight must also be non-zero and aZoom must be zero. The image will be scaled to this width.
[in]aHeightPage height (document coordinates) or zero. If this argument is non-zero, aWidth must also be non-zero and aZoom must be zero. The image will be scaled to this height.
[in]aFlagsFlags modifying the behavior of this function, See enum ImportImageFlags. ii_keep_aspect_ratio is not needed if aZoom is non-zero.
[in]aEncodingThe encoding of aDescription.
[in]aDescriptionAlternate description for the image. If this value is an empty string, aEncoding and aLang will be ignored. If this value is an empty string and the document uses Tagged PDF, "image" with language code "en" will be used to avoid breaking standard compliance. It is strongly recommended to use a meaningful description. Escape sequences must not be used.
[in]aLangLanguage identifier for aDescription. Unless aDescription is an empty string, this must be a string containing an RFC 3066 language tag. Example: "en-US".
Returns
ReturnCode::rc_ok iff successful.
See also
addImageFromMemory(), addImageFromMemory2(), importPageFromImageBlob(), importPageFromImageFile(), importPageFromImageFile2(), isTaggedPDF(), f_fail_for_broken_target_structure
ReturnCode importPageFromImageFile ( int  aTargetPage,
Encoding  aEncoding,
const std::string &  aPath,
double  aZoom,
double  aWidth,
double  aHeight,
int  aFlags 
)
inline

Import a page from a file containing an image.

This function behaves like importPageFromImageFile2() with an empty string for aDescription, that is, if the document uses Tagged PDF, a dummy alternate description for the image ("image" with language code "en") will provided to avoid breaking standard compliance. It is strongly recommended to use importPageFromImageFile2() with a meaningful description of the image.

This function is currently implemented for PDF documents only.

Parameters
[in]aTargetPageThe 1-based number of the page before which to insert the new page. The page will be appended if this value is 0.
[in]aEncodingThe encoding of aPath.
[in]aPathThe pathname of the file containing the image. Supported formats for inserting into PDF documents are: JPEG, PNG, GIF, TIFF, and BMP.
[in]aZoomZoom factor or zero. If this argument is non-zero, aWidth and aHeight must be zero. The size of the page is computed from the image size and resolution, multiplied by aZoom.
[in]aWidthPage width (document coordinates) or zero. If this argument is non-zero, aHeight must also be non-zero and aZoom must be zero. The image will be scaled to this width.
[in]aHeightPage height (document coordinates) or zero. If this argument is non-zero, aWidth must also be non-zero and aZoom must be zero. The image will be scaled to this height.
[in]aFlagsFlags modifying the behavior of this function, See enum ImportImageFlags. ii_keep_aspect_ratio is not needed if aZoom is non-zero.
Returns
ReturnCode::rc_ok iff successful.
See also
addImageFromFile(), addImageFromFile2(), importPageFromImageBlob(), importPageFromImageBlob2(), importPageFromImageFile2(), isTaggedPDF(), f_fail_for_broken_target_structure
ReturnCode importPageFromImageFile2 ( int  aTargetPage,
Encoding  aEncoding,
const std::string &  aPath,
double  aZoom,
double  aWidth,
double  aHeight,
int  aFlags,
Encoding  aEncoding2,
const std::string &  aDescription,
const std::string &  aLang 
)
inline

Import a page from a file containing an image (with alternate description).

This function is currently implemented for PDF documents only.

Parameters
[in]aTargetPageThe 1-based number of the page before which to insert the new page. The page will be appended if this value is 0.
[in]aEncodingThe encoding of aPath.
[in]aPathThe pathname of the file containing the image. Supported formats for inserting into PDF documents are: JPEG, PNG, GIF, TIFF, and BMP.
[in]aZoomZoom factor or zero. If this argument is non-zero, aWidth and aHeight must be zero. The size of the page is computed from the image size and resolution, multiplied by aZoom.
[in]aWidthPage width (document coordinates) or zero. If this argument is non-zero, aHeight must also be non-zero and aZoom must be zero. The image will be scaled to this width.
[in]aHeightPage height (document coordinates) or zero. If this argument is non-zero, aWidth must also be non-zero and aZoom must be zero. The image will be scaled to this height.
[in]aFlagsFlags modifying the behavior of this function, See enum ImportImageFlags. ii_keep_aspect_ratio is not needed if aZoom is non-zero.
[in]aEncoding2The encoding of aDescription.
[in]aDescriptionAlternate description for the image. If this value is an empty string, aEncoding2 and aLang will be ignored. If this value is an empty string and the document uses Tagged PDF, "image" with language code "en" will be used to avoid breaking standard compliance. It is strongly recommended to use a meaningful description. Escape sequences must not be used.
[in]aLangLanguage identifier for aDescription. Unless aDescription is an empty string, this must be a string containing an RFC 3066 language tag. Example: "en-US".
Returns
ReturnCode::rc_ok iff successful.
See also
addImageFromFile(), addImageFromFile2(), importPageFromImageBlob(), importPageFromImageBlob2(), importPageFromImageFile2(), isTaggedPDF(), f_fail_for_broken_target_structure
ReturnCode importPages ( int  aTargetPage,
SignDocDocument aSource,
int  aSourcePage,
int  aPageCount,
int  aFlags 
)
inline

Import pages from another document.

This function is currently implemented for PDF documents only. The pages to be imported must not contain any interactive fields having names that are already used for interactive fields in the target document.

Page labels are currently ignored, that is, they will probably be messed up in the target document.

Unless flag siff_allow_breaking_tagged_pdf is set, this function may fail for some values of aTargetPage as the target structure may not be suitable for insertion of pages between certain pages. Appending pages after the last page should always work.

Parameters
[in]aTargetPageThe 1-based number of the page before which to insert the copied pages. The pages will be appended if this value is 0.
[in]aSourceThe document from which to copy the pages. aSource can be this.
[in]aSourcePageThe 1-based number of the first page (in the source document) to be copied.
[in]aPageCountThe number of pages to be copied. All pages of aSource starting with aSourcePage will be copied if this value is 0.
[in]aFlagsMust be zero.
Returns
ReturnCode::rc_ok iff successful.
See also
isTaggedPDF(), setFlags(), f_fail_for_broken_target_structure, siff_allow_breaking_tagged_pdf
ReturnCode importProperties ( const std::string &  aCollection,
InputStream aStream,
int  aFlags 
)
inline

Import properties from XML (reading a stream).

The input must conform to schema AllSignDocProperties.xsd (if aCollection is empty) or SignDocProperties.xsd (if aCollection is non-empty).

Parameters
[in]aCollectionThe name of the collection, see getProperties(). If the string is empty, properties will be imported into all collections, otherwise properties will be imported into the specified collection.
[in]aStreamThe properties will be read from this stream. This function reads the input completely, it doesn't stop at the end tag.
[in]aFlagsFlags modifying the behavior of this function, see enum ImportFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
exportProperties(), exportPropertiesToMemory(), importPropertiesFromMemory()
ReturnCode importPropertiesFromMemory ( const std::string &  aCollection,
const unsigned char *  aPtr,
size_t  aSize,
int  aFlags 
)
inline

Import properties from XML (reading a blob).

The input must conform to schema AllSignDocProperties.xsd (if aCollection is empty) or SignDocProperties.xsd (if aCollection is non-empty).

Parameters
[in]aCollectionThe name of the collection, see getProperties(). If the string is empty, properties will be imported into all collections, otherwise properties will be imported into the specified collection.
[in]aPtrThe properties will be read from the blob pointed to by this argument.
[in]aSizeNumber of octets pointed to by aPtr.
[in]aFlagsFlags modifying the behavior of this function, see enum ImportFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
exportProperties(), exportPropertiesToMemory(), importProperties()
ReturnCode isModified ( bool &  aModified) const
inline

Check if the document has unsaved changes.

Parameters
[out]aModifiedWill be set to true if the document has unsaved changes, will be set to false if the document does not have unsaved changes.
Returns
ReturnCode::rc_ok iff successful.
ReturnCode isTaggedPDF ( bool &  aTaggedPDF) const
inline

Check if the document is a Tagged PDF document.

Parameters
[out]aTaggedPDFWill be set to true if the document is a Tagged PDF document, will be set to false if the document is not a Tagged PDF document.
ReturnCode removeAnnotation ( Encoding  aEncoding,
int  aPage,
const std::string &  aName 
)
inline

Remove an annotation identified by name.

Parameters
[in]aEncodingThe encoding of aName.
[in]aPageThe page number (1 for the first page).
[in]aNameThe name of the annotation, must not be empty.
Returns
ReturnCode::rc_ok iff successful.
See also
addAnnotation(), flattenAnnotations(), getAnnotations(), SignDocAnnotation::setName()
ReturnCode removeAttachment ( Encoding  aEncoding,
const std::string &  aName 
)
inline

Remove an attachment from the document.

Attachments are supported for PDF documents only.

Parameters
[in]aEncodingThe encoding of aName.
[in]aNameThe name of the attachment.
Returns
ReturnCode::rc_ok iff successful.
See also
addAttachmentBlob(), addAttachmentFile(), getAttachments()
ReturnCode removeDocMDP ( )
inline

Remove any certification signature.

This function does nothing for TIFF documents as TIFF documents do not have certification signatures.

See also
clearAllSignatures(), getDocMDP(), removePDFA(), removePDFUA(), removePermissions(), setShootInFoot()
Returns
ReturnCode::rc_ok iff successful.
ReturnCode removeField ( Encoding  aEncoding,
const std::string &  aName 
)
inline

Remove a field.

Removing a field of a TIFF document will invalidate all signatures.

Parameters
[in]aEncodingThe encoding of aName.
[in]aNameThe fully-qualified name of the field.
Returns
ReturnCode::rc_ok iff successful.
See also
addField(), flattenField(), getFields()
ReturnCode removeLogicalStructure ( unsigned  aFlags)
inline

Remove the logical structure.

This function is available for PDF documents only.

Parameters
[in]aFlagsMust be 0.
Returns
ReturnCode::rc_ok iff successful.
See also
isTaggedPDF()
ReturnCode removePages ( const int *  aPagesPtr,
int  aPagesCount,
KeepOrRemove  aMode 
)
inline

Remove pages from the document.

A document must have at least page. This function will fail if you attempt to remove all pages.

Fields will be removed if all their widgets are on removed pages.

Only signatures in signature fields having the SignDocField::f_SinglePage flag set can survive removal of pages.

Parameters
[in]aPagesPtrPointer to an array of one-based page numbers. The order does not matter, neither does the number of occurences of a page number.
[in]aPagesCountNumber of page numbers pointed to by aPagesPtr.
[in]aModeTell this function whether to keep or to remove the pages specified by aPagesPtr.
Returns
ReturnCode::rc_ok iff successful.
ReturnCode removePDFA ( unsigned  aFlags)
inline

Remove PDF/A conformance.

Some operations on PDF documents (such as using standard fonts) are not allowed in PDF/A documents. This function turns a PDF/A document into a plain document, enabling those operations.

This function is available for PDF documents only.

Parameters
[in]aFlagsMust be 0.
Returns
ReturnCode::rc_ok iff successful.
See also
removePDFUA(), removePermissions()
ReturnCode removePDFUA ( unsigned  aFlags)
inline

Remove PDF/UA conformance.

Some operations on PDF documents (such as using standard fonts) are not allowed in PDF/UA documents. This function turns a PDF/UA document into a plain document, enabling those operations.

This function is available for PDF documents only.

Parameters
[in]aFlagsMust be 0.
Returns
ReturnCode::rc_ok iff successful.
See also
removePDFA(), removePermissions()
ReturnCode removePermissions ( unsigned  aFlags)
inline

Remove signatures that grant permissions.

If you want to modify (beyond adding signature fields, signing signature fields, and filling in form fields) a PDF document that has permissions granted to Adobe Reader by digital signatures, you have to remove those signatures first by calling this function. That action will remove the permissions for Adobe Reader but enable modifying the document without breaking those signatures.

Permissions granted via encryption are not altered by this function.

This function is available for PDF documents only.

Parameters
[in]aFlagsMust be 0.
Returns
ReturnCode::rc_ok iff successful.
See also
removePDFA(), removePDFUA(), setShootInFoot()
ReturnCode removeProperty ( Encoding  aEncoding,
const std::string &  aCollection,
const std::string &  aName 
)
inline

Remove a SignDoc property.

In the "public" and "encrypted" collections, property names are compared under Unicode simple case folding, that is, lower case and upper case is not distinguished.

Parameters
[in]aEncodingThe encoding of aName.
[in]aCollectionThe name of the collection, see getProperties().
[in]aNameThe name of the property.
Returns
ReturnCode::rc_ok iff successful.
See also
getProperties(), setStringProperty()
ReturnCode removeXFA ( unsigned  aFlags)
inline

Remove XFA (XML Forms Architecture) content.

SignDoc SDK does not support XFA (XML Forms Architecture) and therefore addSignature(), addField(), applyFdf(), and setField() remove XFA from the document to avoid descrepancies between "classic" form fields and XFA. This function is available for PDF documents only.

You can also remove XFA content by calling this function. It will fail if the document prohibits removal of XFA (removing XFA from signed documents breaks signatures).

This function is available for PDF documents only.

Parameters
[in]aFlagsMust be 0.
Returns
ReturnCode::rc_ok iff successful.
ReturnCode renderPageAsImage ( std::vector< unsigned char > &  aImage,
SignDocRenderOutput aOutput,
const SignDocRenderParameters aRenderParameters,
const SignDocVerificationParameters aVerificationParameters,
const Rect aClipRect 
)
inline

Render the selected page (or pages) as image.

Parameters
[out]aImageThe image will be stored here as a blob.
[out]aOutputThe image size will be stored here.
[in]aRenderParametersParameters such as the page number.
[in]aVerificationParametersParameters for verification of signatures. Used only if boolean parameter "AddDecorations" of aRenderParameters has been set to true. Currently, signatures are verified one after another and the "Timeout" integer parameter applies to each verification. Pass nullptr for default parameters.
[in]aClipRectThe rectangle to be rendered (using document coordinates, see Coordinate Systems) or nullptr to render the complete page.
Returns
ReturnCode::rc_ok iff successful.
See also
computeZoom(), getRenderedSize(), renderPageAsSignDocImage()
ReturnCode renderPageAsSignDocImage ( std::unique_ptr< SignDocImage > &  aImage,
SignDocRenderOutput aOutput,
const SignDocRenderParameters aRenderParameters,
const SignDocVerificationParameters aVerificationParameters,
const Rect aClipRect 
)
inline

Render the selected page (or pages) as SignDocImage object.

Only a single page can be rendered.

Parameters
[out]aImageThe SignDocImage object containing the rendered page will be stored here.
[out]aOutputThe image size will be stored here.
[in]aRenderParametersParameters such as the page number.
[in]aVerificationParametersParameters for verification of signatures. Used only if boolean parameter "AddDecorations" of aRenderParameters has been set to true. Currently, signatures are verified one after another and the "Timeout" integer parameter applies to each verification. Pass nullptr for default parameters.
[in]aClipRectThe rectangle to be rendered (using document coordinates, see Coordinate Systems) or nullptr to render the complete page.
Returns
ReturnCode::rc_ok iff successful.
See also
computeZoom(), getRenderedSize(), renderPageAsImage()
ReturnCode saveToFile ( Encoding  aEncoding,
const char *  aPath,
int  aFlags 
)
inline

Save the document to a file.

After a successful call to this function, the document behaves as if it had been loaded from the specified file.

Saving a signed PDF document without sf_incremental will fail unless sf_auto_incremental is also set. See also getRequiredSaveToFileFlags().

The file will remain open until the document is saved again or the SignDocDocument object is closed or destroyed.

Parameters
[in]aEncodingThe encoding of the string pointed to by aPath.
[in]aPathThe pathname of the file to be created or overwritten. Pass nullptr to save to the file from which the document was loaded or most recently saved (which will fail if the documment was loaded from memory or saved to a stream). See Using SignDoc SDK in Windows Store apps for restrictions on pathnames in Windows Store apps.
[in]aFlagsSet of flags (of enum SaveFlags, combined with `|') modifying the behavior of this function. Pass 0 for no flags. Which flags are available depends on the document type. Which flags are required depends on the document state. Call getRequiredSaveToFileFlags() to get the flags that are required.
Returns
ReturnCode::rc_ok iff successful.
See also
copyToMemory(), copyToStream(), getRequiredSaveToFileFlags(), getSaveToFileFlags(), saveToMemory(), saveToStream(), SignDocDocumentLoader::loadFromFile(), SignDocDocumentLoader::loadFromMemory()
ReturnCode saveToFile ( const wchar_t *  aPath,
int  aFlags 
)
inline

Save the document to a file.

After a successful call to this function, the document behaves as if it had been loaded from the specified file.

Saving a signed PDF document without sf_incremental will fail unless sf_auto_incremental is also set. See also getRequiredSaveToFileFlags().

The file will remain open until the document is saved again or the SignDocDocument object is closed or destroyed.

Parameters
[in]aPathThe pathname of the file to be created or overwritten. Pass nullptr to save to the file from which the document was loaded or most recently saved (which will fail if the documment was loaded from memory or saved to a stream).
[in]aFlagsSet of flags (of enum SaveFlags, combined with `|') modifying the behavior of this function. Pass 0 for no flags. Which flags are available depends on the document type.
Returns
ReturnCode::rc_ok iff successful.
See also
copyToMemory(), copyToStream(), getSaveToFileFlags(), saveToMemory(), saveToStream(), SignDocDocumentLoader::loadFromFile(), SignDocDocumentLoader::loadFromMemory()
ReturnCode saveToMemory ( std::vector< unsigned char > &  aBlob,
int  aFlags 
)
inline

Save the document to a blob.

This function may have side effects on the document such as marking it as not modified which may render sf_incremental useless for the next saveToFile() call unless the document is changed between those two calls.

After calling this function successfully, the document will be backed by memory.

Parameters
[in,out]aBlobThe document will be saved to this blob.
[in]aFlagsSet of flags (of enum SaveFlags, combined with `|') modifying the behavior of this function. Pass 0 for no flags. Which flags are available depends on the document type.
Returns
ReturnCode::rc_ok iff successful.
See also
copyToMemory(), getSaveToStreamFlags(), saveToFile(), saveToStream(), SignDocDocumentLoader::loadFromFile(), SignDocDocumentLoader::loadFromMemory()
ReturnCode saveToStream ( OutputStream aStream,
int  aFlags 
)
inline

Save the document to a stream.

This function may have side effects on the document such as marking it as not modified which may render sf_incremental useless for the next saveToFile() call unless the document is changed between those two calls.

After calling this function successfully, the document will be backed by memory.

Parameters
[in]aStreamThe document will be saved to this stream.
[in]aFlagsSet of flags (of enum SaveFlags, combined with `|') modifying the behavior of this function. Pass 0 for no flags. Which flags are available depends on the document type.
Returns
ReturnCode::rc_ok iff successful.
See also
copyToStream(), getSaveToStreamFlags(), saveToFile(), saveToMemory(), SignDocDocumentLoader::loadFromFile(), SignDocDocumentLoader::loadFromMemory()
ReturnCode setBooleanProperty ( Encoding  aEncoding,
const std::string &  aCollection,
const std::string &  aName,
bool  aValue 
)
inline

Set the value of a SignDoc property (boolean).

In the "public" and "encrypted" collections, property names are compared under Unicode simple case folding, that is, lower case and upper case is not distinguished.

It's not possible to change the type of a property.

Parameters
[in]aEncodingThe encoding of aName.
[in]aCollectionThe name of the collection, see getProperties().
[in]aNameThe name of the property.
[in]aValueThe new value of the property.
Returns
ReturnCode::rc_ok iff successful.
See also
getProperties(), removeProperty(), setIntegerProperty(), setStringProperty(), addSignature()
ReturnCode setCompatibility ( int  aMajor,
int  aMinor 
)
inline

Request to not make changes to the document which are incompatible with an older version of this class.

No features introduced after aMajor.aMinor will be used.

Passing a version number before 1.11 or after the current version will fail.

Parameters
[in]aMajorMajor version number.
[in]aMinorMinor version number.
Returns
ReturnCode::rc_ok iff successful.
ReturnCode setCompressionLevel ( int  aLevel)
inline

Set the FlateDecode compression level.

Calling this function has an effect for PDF documents only. You might want to use a low compression level on slow machines such as mobile devices. That will speed up operations such as embedding fonts, adding attachments, and adding images.

Parameters
[in]aLevelThe new compression level for encoding data with the FlateDecode filter. Allowed values are 0 (fastest, do not use FlateDecode), and 1 (fast, least compression) through 9 (slowest, best compression). The default value is 6.
Returns
ReturnCode::rc_ok iff successful.
ReturnCode setDefaultDocumentLanguage ( Encoding  aEncoding,
const std::string &  aLang 
)
inline

Set the language identifier to be used if a language identifier is required but the document doesn't provide one.

If this function is not called, "en" will be used.

This function is available for PDF documents only.

Parameters
[in]aEncodingThe encoding of aLang.
[in]aLangAn RFC 3066 language tag. Must not be an empty string. Example: "en-US".
Returns
ReturnCode::rc_ok iff successful.
See also
getDocumentLanguage(), setDocumentLanguage(), f_require_alternate_field_name, f_require_lang
ReturnCode setDocumentLanguage ( Encoding  aEncoding,
const std::string &  aLang 
)
inline

Set the document's natural language.

That language applies to all text unless overridden locally.

This function is available for PDF documents only.

Parameters
[in]aEncodingThe encoding of aLang.
[in]aLangThe natural language for the document (an RFC 3066 language tag). Must not be an empty string. Example: "en-US".
Returns
ReturnCode::rc_ok iff successful.
See also
getDocumentLanguage(), setDefaultDocumentLanguage(), f_require_alternate_field_name, f_require_lang
ReturnCode setField ( SignDocField aField,
unsigned  aFlags 
)
inline

Change a field.

This function changes a field in the document using attributes from a SignDocField object. Everything except for the name and the type of the field can be changed. See the member functions of SignDocField for details.

Always get a SignDocField object for a field by calling getField(), getFields(), or getFields(), then apply your modifications to that object, then call setField().

Applications should not call setField() for fields that are locked, ie, have SignDocField::f_ReadOnly set in the return value of SignDocField::getFlags(). However, setField() does not fail in that case.

The coordinates of the field are not changed unless sff_move is set in aFlags.

Do not try to build a SignDocField object from scratch for changing a field as future versions of the SignDocField class may have additional attributes.

This function is implemented for PDF documents only.

This function always fails for PDF documents that have signed signature fields.

Parameters
[in,out]aFieldThe field to be changed. The font resource name of the default text field attributes may be modified. The value index and the value may be modified for radio button fields and check box fields.
[in]aFlagsSet of flags (of enum SetFieldFlags, combined with `|') modifying the behavior of this function. Pass 0 for no flags.
Returns
ReturnCode::rc_ok iff successful.
See also
addField(), getFields(), removeField(), f_fail_for_broken_target_structure, f_require_alternate_field_name
ReturnCode setFlags ( unsigned  aFlags)
inline

Set flags modifying the behavior of various functions.

The default is value is 0.

Parameters
[in]aFlagsNew set of flags, see enum Flags.
Returns
ReturnCode::rc_ok iff successful.
See also
getFlags(), setShootInFoot()
void setImpl ( SIGNDOC_Document *  aP)
inline

Internal function.

ReturnCode setIntegerProperty ( Encoding  aEncoding,
const std::string &  aCollection,
const std::string &  aName,
int  aValue 
)
inline

Set the value of a SignDoc property (integer).

In the "public" and "encrypted" collections, property names are compared under Unicode simple case folding, that is, lower case and upper case is not distinguished.

It's not possible to change the type of a property.

Parameters
[in]aEncodingThe encoding of aName.
[in]aCollectionThe name of the collection, see getProperties().
[in]aNameThe name of the property.
[in]aValueThe new value of the property.
Returns
ReturnCode::rc_ok iff successful.
See also
getProperties(), removeProperty(), setBooleanProperty(), setStringProperty(), addSignature()
ReturnCode setShootInFoot ( unsigned  aFlags)
inline

Disable safety checks.

The default value, 0, makes operations fail which would invalidate existing signatures (signature fields) or signatures granting permissions.

Note
If you set any flags you risk shooting yourself in the foot.
Parameters
[in]aFlagsNew set of flags, see enum ShootInFootFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
getShootInFoot(), removePermissions(), setFlags(), SignDocField::getDocMDP()
ReturnCode setStringProperty ( Encoding  aEncoding,
const std::string &  aCollection,
const std::string &  aName,
const std::string &  aValue 
)
inline

Set the value of a SignDoc property (string).

In the "public" and "encrypted" collections, property names are compared under Unicode simple case folding, that is, lower case and upper case is not distinguished.

It's not possible to change the type of a property. Embedded NUL characters are not supported.

Parameters
[in]aEncodingThe encoding of aName and aValue.
[in]aCollectionThe name of the collection, see getProperties().
[in]aNameThe name of the property.
[in]aValueThe new value of the property.
Returns
ReturnCode::rc_ok iff successful.
See also
getProperties(), removeProperty(), setBooleanProperty(), setIntegerProperty(), addSignature()
ReturnCode setTextFieldAttributes ( SignDocTextFieldAttributes aData)
inline

Set the document's default text field attributes.

Font name, font size, and text color must be specified. This function fails if aData has any but not all attributes set or if any of the attributes are invalid.

This function fails for signed PDF document.

This function always fails for TIFF documents.

Parameters
[in,out]aDataThe new default text field attributes. The font resource name will be updated.
Returns
ReturnCode::rc_ok iff successful.
See also
addField(), getTextFieldAttributes(), SignDocField::setTextFieldAttributes()
void splitEscapeSequences ( const std::string &  aInput,
std::vector< std::string > &  aOutput 
)
inlinestatic

Split a string obtained from a PDF text string into escape sequences and text segments.

You don't need to call this function unless flag f_keep_escape_sequences is set.

Parameters
[in]aInputThe input string (UTF-8 or ISO 8859-1).
[out]aOutputThe escape sequences and text segments will be stored here. The escape characters are not removed from escape sequences.
See also
withoutEscapeSequence(), f_keep_escape_sequences
ReturnCode updateDSS ( const SignDocVerificationParameters aParameters,
unsigned  aFlags,
int &  aCount 
)
inline

Update the DSS for any eligible signatures in the document.

This function is available for PDF documents only.

To extend the validity of the signatures in a PDF document (long term validity LTV), call this function, save the document incrementally, and add a document time stamp.

If the document already has a document time stamp, this function adds information for the latest document time stamp to the DSS. If the document does not have a document time stamp, this function adds information for all eligible signature fields to the DSS.

This function fails if verification fails for any of the signatures.

Parameters
[in]aParametersA pointer to an object containing Verification parameters or nullptr for default parameters.
[in]aFlagsFlags modifying the behavior of this function, see enum UpdateDSSFlags.
[out]aCountIf udf_simulate is not set in aFlags, the number of signature fields for which information has been added to the DSS will be stored in this object. If udf_simulate is set in aFlags, the number of eligible signature fields will be stored in this object.
Returns
ReturnCode::rc_ok iff successful.
See also
updateDSS2()
ReturnCode updateDSS2 ( Encoding  aEncoding,
const std::string &  aFieldName,
const SignDocVerificationParameters aParameters,
unsigned  aFlags 
)
inline

Update the DSS for a signature in the document.

The main purpose of this function is testing SignDoc SDK, please use updateDSS() instead.

This function is available for PDF documents only.

Call this function (possibly a long time) after signing field aFieldName, then save the document incrementally and add a document time stamp. Before applying the first document time stamp, this function should be called for all eligable signature fields. If any document time stamp has already been added, this function should be called for the last document time stamp.

The signature field must have been signed with one of these methods: SignDocSignatureParameters::m_digsig_pkcs7_detached, SignDocSignatureParameters::m_digsig_pkcs7_sha1, SignDocSignatureParameters::m_digsig_cades_detached, or SignDocSignatureParameters::m_digsig_cades_rfc3161.

This function fails if verification fails.

This function does nothing if the signature field is not signed.

Parameters
[in]aEncodingThe encoding of aFieldName.
[in]aFieldNameThe name of the signature field encoded according to aEncoding.
[in]aParametersA pointer to an object containing Verification parameters or nullptr for default parameters.
[in]aFlagsFlags modifying the behavior of this function, see enum UpdateDSSFlags.
Returns
ReturnCode::rc_ok iff successful.
See also
addSignature(), updateDSS(), getFields()
ReturnCode verifySignature ( Encoding  aEncoding,
const std::string &  aFieldName,
std::unique_ptr< SignDocVerificationResult > &  aOutput 
)
inline

Verify a signature of the document.

There is a setFlags() flag modifying the behavior of this function: f_relax_byte_range.

Parameters
[in]aEncodingThe encoding of aFieldName.
[in]aFieldNameThe name of the signature field encoded according to aEncoding.
[out]aOutputA pointer to a new SignDocVerificationResult object or nullptr will be stored here. The caller is responsible for destroying that object.
Returns
ReturnCode::rc_ok iff successful.
See also
getSignature(), setFlags(), verifySignature2(), SignDocField::getSignatureType(), SignDocField::isSigned()
ReturnCode verifySignature ( const wchar_t *  aFieldName,
std::unique_ptr< SignDocVerificationResult > &  aOutput 
)
inline

Verify a signature of the document.

There is a setFlags() flag modifying the behavior of this function: f_relax_byte_range.

Parameters
[in]aFieldNameThe name of the signature field.
[out]aOutputA pointer to a new SignDocVerificationResult object or nullptr will be stored here. The caller is responsible for destroying that object.
Returns
ReturnCode::rc_ok iff successful.
See also
getSignature(), setFlags(), verifySignature2(), SignDocField::getSignatureType(), SignDocField::isSigned()
ReturnCode verifySignature2 ( const SignDocSignature aSignature,
std::unique_ptr< SignDocVerificationResult > &  aOutput 
)
inline

Verify a signature of the document.

These are the differences between calling this function and calling verifySignature() with the field name obtained from aSignature:

  • This function fails unless aSignature.getClearedIndex() returns -1.
  • PDF only: This function uses the DSS of the first document time stamp following the signature described by aSignature. If there is no such document time stamp, the latest DSS will be used. This behavior is required for verifying signatures with LTV (long term validity).

There is a setFlags() flag modifying the behavior of this function: f_relax_byte_range.

Parameters
[in]aSignatureA SignDocSignature object for this document.
[out]aOutputA pointer to a new SignDocVerificationResult object or nullptr will be stored here. The caller is responsible for destroying that object.
Returns
ReturnCode::rc_ok iff successful.
See also
getSignature(), setFlags(), verifySignature(), SignDocField::getSignatureType(), SignDocField::isSigned()
std::string withEscapeSequence ( const std::string &  aText,
const std::string &  aLang 
)
inlinestatic

Prepend an escape sequence for specifying the natural language in a text string.

This function throw std::invalid_argument if aLang is invalid.

Parameters
[in]aTextThe text (UTF-8 or ISO 8859-1).
[in]aLangLanguage identifier (an RFC3066 language tag with two-character language code and optional two-character country code). Only the language and the optional country will be used, the dash separating them will be removed. Example: "en-US" will prepend ESC "enUS" ESC.
Returns
A copy of aText with an escape sequence prepended.
See also
withoutEscapeSequences()
std::string withoutEscapeSequences ( const std::string &  aInput)
inlinestatic

Remove escape sequences specifying the natural language in text strings.

You don't need to call this function unless flag f_keep_escape_sequences is set.

Parameters
[in]aInputThe input string (UTF-8 or ISO 8859-1).
Returns
A copy of aInput with escape sequences removed.
See also
splitEscapeSequences(), withEscapeSequence(), f_keep_escape_sequences

The documentation for this class was generated from the following file: