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.
Declaration
Objective-C
- (PTPDFDoc *)FillTemplateJson:(NSString *)json;
Swift
func fillTemplateJson(_ json: String!) -> PTPDFDoc!
Parameters
json
– A 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.
Declaration
Objective-C
- (void)FillTemplateJsonToOffice:(NSString *)json output_path:(NSString *)output_path;
Swift
func fillTemplateJson(toOffice json: String!, output_path: String!)
Parameters
json
– A JSON dictionary mapping template keys to their replacement content.
output_path
– The 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 finsihed 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 template filling process.
Declaration
Objective-C
- (PTTemplateDocumentResult)GetConversionStatus;
Swift
func getConversionStatus() -> PTTemplateDocumentResult
Return Value
.
-
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() -> Bool
Return Value
Returns true if CancelConversion has been called previously.
-
Return the number of warning strings generated during the template filling process. 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() -> UInt32
Return Value
The number of stored warning strings.
-
Retrieve warning strings that have been collected during the template filling process. 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
index
– the 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!()