PTFDFDoc
@interface PTFDFDoc : NSObject
FDFDoc is a class representing Forms Data Format (FDF) documents. FDF is typically used when submitting form data to a server, receiving the response, and incorporating it into the interactive form. It can also be used to export form data to stand-alone files that can be stored, transmitted electronically, and imported back into the corresponding PDF interactive form. In addition, beginning in PDF 1.3, FDF can be used to define a container for annotations that are separate from the PDF document to which they apply.
Note: While the constructor does not, a few methods in FDFDoc will cause it to count as a document for the consumption-based licensing if was not created through PDFDoc::FDFExtract(). Please consult individual API documentation for exact details.
-
Create a FDF document from an existing SDF/Cos document.
Note
the SDFDoc will become invalid. If you would like to access the low level document use GetSDFDocDeclaration
Objective-C
- (instancetype)init;
Swift
init!()
Parameters
sdfdoc
An SDF document. FDFDoc will take the ownership of the low-level document.
-
Undocumented
Declaration
Objective-C
- (instancetype)initWithFilepath: (NSString *)filepath;
Swift
init!(filepath: String!)
-
Close FDFDoc
Declaration
Objective-C
- (void)Close;
Swift
func close()
-
Declaration
Objective-C
- (BOOL)IsModified;
Swift
func isModified() -> Bool
Return Value
- true if document was modified, false otherwise
-
Saves the document to a file.
If a full save is requested to the original path, the file is saved to a file system-determined temporary file, the old file is deleted, and the temporary file is renamed to path.
A full save with remove unused or linearization option may re-arrange object in the cross reference table. Therefore all pointers and references to document objects and resources should be re acquired in order to continue document editing.
In order to use incremental save the specified path must match original path and e_incremental flag bit should be set.
@exception - if the file can’t be opened for saving or if there is a problem during Save an Exception object will be thrown.
Note
This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.Declaration
Objective-C
- (void)SaveFDFDocToFile:(NSString *)path;
Swift
func save(toFile path: String!)
Parameters
path
- The full path name to which the file is saved.
-
Saves the document to a memory buffer.
@exception - if there is a problem during Save an Exception object will be thrown.
Note
This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.Declaration
Objective-C
- (NSData *)SaveFDFDocToBuf;
Swift
func saveToBuf() -> Data!
-
Note
This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.Return Value
- A dictionary representing the Cos root of the document (document’s trailer)
-
Note
This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.Return Value
- A dictionary representing the Cos root of the document (/Root entry within the trailer dictionary)
-
Get the PDF document file that this FDF file was exported from or is intended to be imported into.
Declaration
Objective-C
- (NSString *)GetPDFFileName;
Swift
func getPDFFileName() -> String!
Return Value
a String with the PDF document file name.
-
Set the PDF document file that this FDF file was exported from or is intended to be imported into.
Declaration
Objective-C
- (void)SetPDFFileName:(NSString *)filepath;
Swift
func setPDFFileName(_ filepath: String!)
Parameters
filepath
- pathname to the file.
-
An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A FDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document.
The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms).
Note
if the document has no AcroForms, HasNext() will return false.Declaration
Objective-C
- (PTFDFFieldIterator *)GetFieldIterator;
Swift
func getFieldIterator() -> PTFDFFieldIterator!
Return Value
an iterator to the first FDFField in the document.
-
An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A FDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document.
The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms).
Note
if the document has no AcroForms, HasNext() will return false.Declaration
Objective-C
- (PTFDFFieldIterator *)GetFieldIteratorWithFieldName:(NSString *)field_name;
Swift
func getFieldIterator(withFieldName field_name: String!) -> PTFDFFieldIterator!
Parameters
field_name
String representing the name of the FDFField to get.
Return Value
an iterator to the FDFField in the document.
-
Declaration
Objective-C
- (PTFDFField *)GetField:(NSString *)field_name;
Swift
func getField(_ field_name: String!) -> PTFDFField!
Parameters
field_name
- a string representing the fully qualified name of the field (e.g. “employee.name.first”).
Return Value
a FDFField associated with the given field_name or invalid field (null) if the field is not found.
-
Create a new interactive form FDFField. @return @exception
Declaration
Objective-C
- (PTFDFField *)FieldCreateWithObj:(NSString *)field_name type:(PTFieldType)type field_value:(PTObj *)field_value;
Swift
func fieldCreate(withObj field_name: String!, type: PTFieldType, field_value: PTObj!) -> PTFDFField!
-
Undocumented
Declaration
Objective-C
- (PTFDFField*)FieldCreate: (NSString *)field_name type: (PTFieldType)type;
Swift
func fieldCreate(_ field_name: String!, type: PTFieldType) -> PTFDFField!
-
Undocumented
Declaration
Objective-C
- (PTFDFField*)FieldCreateWithString: (NSString *)field_name type: (PTFieldType)type field_value: (NSString *)field_value;
Swift
func fieldCreate(with field_name: String!, type: PTFieldType, field_value: String!) -> PTFDFField!
-
Create a new FDFDoc from XFDF input. Input can be either a XFDF file path, or the XFDF data itself.
Declaration
Objective-C
+ (PTFDFDoc *)CreateFromXFDF:(NSString *)file_name;
Swift
class func create(fromXFDF file_name: String!) -> PTFDFDoc!
Parameters
file_name
- string containing either the file path to a XFDF file, or the XML buffer containing the XFDF.
Return Value
A new FDFDoc.
-
Export FDF file as an XFDF file
Declaration
Objective-C
- (void)SaveAsXFDF:(NSString *)filepath;
Swift
func save(asXFDF filepath: String!)
Parameters
filepath
- the filepath of the exported XFDF file
-
Export FDF file as an XFDF file
Declaration
Objective-C
- (void)SaveAsXFDFWithOptions:(NSString *)filepath opts:(PTXFDFExportOptions *)opts;
Swift
func saveAsXFDF(withOptions filepath: String!, opts: PTXFDFExportOptions!)
Parameters
filepath
- the filepath of the exported XFDF file
opts
Options controlling finer parameters of xfdf export
-
Export FDF file as a XFDF string
Declaration
Objective-C
- (NSString *)SaveAsXFDFToString;
Swift
func saveAsXFDFToString() -> String!
Parameters
opts
Options controlling finer parameters of xfdf export
-
Export FDF file as a XFDF string
Declaration
Objective-C
- (NSString *)SaveAsXFDFToStringWithOptions:(PTXFDFExportOptions *)opts;
Swift
func saveAsXFDFToString(with opts: PTXFDFExportOptions!) -> String!
Parameters
opts
Options controlling finer parameters of xfdf export
Return Value
A UString containing the XFDF representation of the FDF file
-
Merge the annotations from XFDF file into FDF file
Declaration
Objective-C
- (void)MergeAnnots:(NSString *)command_file permitted_user:(NSString *)permitted_user;
Swift
func mergeAnnots(_ command_file: String!, permitted_user: String!)
Parameters
command_file
- string containing the xml command file path or xml string of the command
permitted_user
- optional user name of the permitted user