Class TemplateDocument
Encapsulates a template document that can merged with data to generate any number of PDFs.
Inheritance
Implements
Inherited Members
Namespace: pdftron.PDF
Assembly: PDFNetiOS.dll
Syntax
public class TemplateDocument : IDisposable
Constructors
TemplateDocument(IntPtr)
Declaration
public TemplateDocument(IntPtr impl_ptr)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | impl_ptr |
Methods
CancelConversion()
Cancel the current template filling, forcing FillTemplateJson to return.
Declaration
public void CancelConversion()
CreateInternal(IntPtr)
Declaration
public static TemplateDocument CreateInternal(IntPtr imp)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | imp |
Returns
| Type | Description |
|---|---|
| TemplateDocument |
Destroy()
Declaration
public void Destroy()
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
FillTemplateJson(String)
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
public PDFDoc FillTemplateJson(string json)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | json | A JSON dictionary mapping template keys to their replacement content. |
Returns
| Type | Description |
|---|---|
| PDFDoc | The PDFDoc from the template filling result. |
FillTemplateJsonToOffice(String, String)
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
public void FillTemplateJsonToOffice(string json, string output_path)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | json | A JSON dictionary mapping template keys to their replacement content. |
| System.String | output_path | The path where the output file is written. |
FillTemplateJsonToOfficeWithFilter(String, Filter)
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
public void FillTemplateJsonToOfficeWithFilter(string json, Filter out_filter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | json | A JSON dictionary mapping template keys to their replacement content. |
| Filter | out_filter | An output filter where the office file will be written.. |
Finalize()
Declaration
protected void Finalize()
GetConversionStatus()
Get the state of the most recent template filling operation.
Declaration
public TemplateDocumentResult GetConversionStatus()
Returns
| Type | Description |
|---|---|
| TemplateDocumentResult |
GetErrorString()
If the template filling finished with some kind of error, this returns the value of the error description; otherwise returns an empty string.
Declaration
public string GetErrorString()
Returns
| Type | Description |
|---|---|
| System.String | The error description. Will be blank unless GetConversionStatus returns Failure. |
GetNumWarnings()
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
public int GetNumWarnings()
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of stored warning strings. |
GetTemplateKeysJson()
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
public string GetTemplateKeysJson()
Returns
| Type | Description |
|---|---|
| System.String | The template keys info JSON dictionary, serialized into a string. |
GetWarningString(Int32)
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
public string GetWarningString(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index of the string to be retrieved. Must be less than GetNumWarnings(). |
Returns
| Type | Description |
|---|---|
| System.String | The value of the particular warning string. |
IsCancelled()
Has the template filling been cancelled?.
Declaration
public bool IsCancelled()
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns true if CancelConversion has been called for the current template filling operation. |