- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
pdftron::PDF::TemplateDocument Class Reference

`#include <TemplateDocument.h>`

## Public Types
enum | Result { eSuccess = 0, eIncomplete = 1, eFailure = 2 }

## Public Member Functions
| TemplateDocument ()
| TemplateDocument (const TemplateDocument &other)
| TemplateDocument (TRN_TemplateDocument impl)
TemplateDocument & | operator= (const TemplateDocument &other)
| ~TemplateDocument ()
void | Destroy ()
PDFDoc | FillTemplateJson (UString json)
void | FillTemplateJsonToOffice (UString json, UString output_path)
void | FillTemplateJsonToOfficeWithFilter (UString json, Filters::Filter &output_stream)
UString | GetTemplateKeysJson ()
UString | GetErrorString () const
Result | GetConversionStatus () const
void | CancelConversion ()
bool | IsCancelled () const
UInt32 | GetNumWarnings () const
UString | GetWarningString (UInt32 index) const
ptrdiff_t | GetHandleInternal ()

## Static Public Member Functions
static TemplateDocument * | CreateInternal (ptrdiff_t impl)

## Public Attributes
TRN_TemplateDocument | m_impl

## Detailed Description

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.

Definition at line 27 of file TemplateDocument.h.

## Member Enumeration Documentation

enum pdftron::PDF::TemplateDocument::Result

Enumerator
eSuccess |
eIncomplete |
eFailure |

Definition at line 30 of file TemplateDocument.h.

## Constructor & Destructor Documentation

pdftron::PDF::TemplateDocument::TemplateDocument | ( |  | ) |

pdftron::PDF::TemplateDocument::TemplateDocument | ( | const TemplateDocument & | other | ) |

pdftron::PDF::TemplateDocument::TemplateDocument | ( | TRN_TemplateDocument | impl | ) |

pdftron::PDF::TemplateDocument::~TemplateDocument | ( |  | ) |

## Member Function Documentation

void pdftron::PDF::TemplateDocument::CancelConversion | ( |  | ) |

Cancel the current template filling, forcing FillTemplateJson to return.

static TemplateDocument* pdftron::PDF::TemplateDocument::CreateInternal | ( | ptrdiff_t | impl | ) |
| static

void pdftron::PDF::TemplateDocument::Destroy | ( |  | ) |

PDFDoc pdftron::PDF::TemplateDocument::FillTemplateJson | ( | UString | json | ) |

Create a PDF by merging JSON data with this template document.

Parameters

  json | A JSON dictionary mapping template keys to their replacement content.

Returns
  The PDFDoc from the template filling result.

void pdftron::PDF::TemplateDocument::FillTemplateJsonToOffice | ( | UString | json,
|  | UString | output_path
| ) |  |

Create an office file by merging JSON data with this template document. This function currently only supports DOCX input.

Parameters

  json | A JSON dictionary mapping template keys to their replacement content.
  output_path | The path where the output file is written.

void pdftron::PDF::TemplateDocument::FillTemplateJsonToOfficeWithFilter | ( | UString | json,
|  | Filters::Filter & | output_stream
| ) |  |

Create an office file by merging JSON data with this template document. This function currently only supports DOCX input.

Parameters

  json | A JSON dictionary mapping template keys to their replacement content.
  output_stream | An output stream.

Result pdftron::PDF::TemplateDocument::GetConversionStatus | ( |  | ) | const

Get the state of the template filling process.

Returns

UString pdftron::PDF::TemplateDocument::GetErrorString | ( |  | ) | const

If the template filling finsihed with some kind of error, this returns the value of the error description; otherwise returns an empty string.

Returns
  The error description. Will be blank unless GetConversionStatus returns Failure.

ptrdiff_t pdftron::PDF::TemplateDocument::GetHandleInternal | ( |  | ) |

UInt32 pdftron::PDF::TemplateDocument::GetNumWarnings | ( |  | ) | const

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.

Returns
  The number of stored warning strings.

UString pdftron::PDF::TemplateDocument::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.

Returns
  The template keys info JSON dictionary, serialized into a string.

UString pdftron::PDF::TemplateDocument::GetWarningString | ( | UInt32 | index | ) | const

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.

Parameters

  index | The index of the string to be retrieved. Must be less than GetNumWarnings().

Returns
  The value of the particular warning string.

bool pdftron::PDF::TemplateDocument::IsCancelled | ( |  | ) | const

Has the template filling been cancelled?.

Returns
  Returns true if CancelConversion has been called previously.

TemplateDocument& pdftron::PDF::TemplateDocument::operator= | ( | const TemplateDocument & | other | ) |

## Member Data Documentation

TRN_TemplateDocument pdftron::PDF::TemplateDocument::m_impl

Definition at line 134 of file TemplateDocument.h.

The documentation for this class was generated from the following file:

- PDF/TemplateDocument.h