Class TemplateDocument
Encapsulates a template document that can merged with data to generate any number of PDFs.
Implements
Inherited Members
Namespace: pdftron.PDF
Assembly: PDFTronDotNet.dll
Syntax
public class TemplateDocument : IDisposable
Constructors
TemplateDocument(IntPtr)
Declaration
public TemplateDocument(IntPtr impl_ptr)
Parameters
| Type | Name | Description |
|---|---|---|
| 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 |
|---|---|---|
| IntPtr | imp |
Returns
| Type | Description |
|---|---|
| TemplateDocument |
Destroy()
Declaration
public void Destroy()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
FillTemplateJson(string)
Create a PDF by merging JSON data with this template document.
Declaration
public PDFDoc FillTemplateJson(string json)
Parameters
| Type | Name | Description |
|---|---|---|
| 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.
Declaration
public void FillTemplateJsonToOffice(string json, string output_path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | json | A JSON dictionary mapping template keys to their replacement content. |
| 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.
Declaration
public void FillTemplateJsonToOfficeWithFilter(string json, Filter out_filter)
Parameters
| Type | Name | Description |
|---|---|---|
| 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.. |
~TemplateDocument()
Declaration
protected ~TemplateDocument()
GetConversionStatus()
Get the state of the template filling process.
Declaration
public TemplateDocumentResult GetConversionStatus()
Returns
| Type | Description |
|---|---|
| TemplateDocumentResult |
GetErrorString()
If the template filling finsihed 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 |
|---|---|
| string | The error description. Will be blank unless GetConversionStatus returns Failure. |
GetNumWarnings()
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
public int GetNumWarnings()
Returns
| Type | Description |
|---|---|
| int | 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 |
|---|---|
| string | The template keys info JSON dictionary, serialized into a string. |
GetWarningString(int)
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
public string GetWarningString(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index of the string to be retrieved. Must be less than GetNumWarnings(). |
Returns
| Type | Description |
|---|---|
| string | The value of the particular warning string. |
IsCancelled()
Has the template filling been cancelled?.
Declaration
public bool IsCancelled()
Returns
| Type | Description |
|---|---|
| bool | Returns true if CancelConversion has been called previously. |