PTTemplateDocument
@interface PTTemplateDocument : NSObject
The class TemplateDocument. Encapsulates a template document that can merged with data to generate any number of PDFs.
TemplateDocument instances are created through the Convert class. See Convert.CreateOfficeTemplate.
-
Create a PDF by merging JSON data with this template document. After returning, this template document object can be reused for more filling operations.
Declaration
Objective-C
- (PTPDFDoc *)FillTemplateJson:(NSString *)json;Swift
func fillTemplateJson(_ json: String!) -> PTPDFDoc!Parameters
jsonA JSON dictionary mapping template keys to their replacement content.
Return Value
The PDFDoc from the template filling result.
-
Create an office file by merging JSON data with this template document. This function currently only supports DOCX input. After returning, this template document object can be reused for more filling operations.
Declaration
Objective-C
- (void)FillTemplateJsonToOffice:(NSString *)json output_path:(NSString *)output_path;Swift
func fillTemplateJson(toOffice json: String!, output_path: String!)Parameters
jsonA JSON dictionary mapping template keys to their replacement content.
output_pathThe path where the output file is written.
-
Get information about the template keys present in the template document. Returns a JSON dictionary following this form: https://www.pdftron.com/api/web/Core.html#.TemplateSchema.
Declaration
Objective-C
- (NSString *)GetTemplateKeysJson;Swift
func getTemplateKeysJson() -> String!Return Value
The template keys info JSON dictionary, serialized into a string.
-
If the template filling finished with some kind of error, this returns the value of the error description; otherwise returns an empty string.
Declaration
Objective-C
- (NSString *)GetErrorString;Swift
func getErrorString() -> String!Return Value
The error description. Will be blank unless GetConversionStatus returns Failure.
-
Get the state of the most recent template filling operation.
@return
Declaration
Objective-C
- (PTTemplateDocumentResult)GetConversionStatus;Swift
func getConversionStatus() -> PTTemplateDocumentResult -
Cancel the current template filling, forcing FillTemplateJson to return.
Declaration
Objective-C
- (void)CancelConversion;Swift
func cancelConversion() -
Has the template filling been cancelled?.
Declaration
Objective-C
- (BOOL)IsCancelled;Swift
func isCancelled() -> BoolReturn Value
Returns true if CancelConversion has been called for the current template filling operation.
-
Return the number of warning strings generated during the current template filling operation. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future.
Declaration
Objective-C
- (unsigned int)GetNumWarnings;Swift
func getNumWarnings() -> UInt32Return Value
The number of stored warning strings.
-
Retrieve warning strings that have been collected during the current template filling operation. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future.
Declaration
Objective-C
- (NSString *)GetWarningString:(unsigned int)index;Swift
func getWarningString(_ index: UInt32) -> String!Parameters
indexThe index of the string to be retrieved. Must be less than GetNumWarnings().
Return Value
The value of the particular warning string.
-
Undocumented
Declaration
Objective-C
+ (PTTemplateDocument*)CreateInternal: (unsigned long long)impl;Swift
class func createInternal(_ impl: UInt64) -> PTTemplateDocument! -
Undocumented
Declaration
Objective-C
- (unsigned long long)GetHandleInternal;Swift
func getHandleInternal() -> UInt64 -
Undocumented
Declaration
Objective-C
- (instancetype)init;Swift
init!()
PTTemplateDocument Class Reference