Loading...
Searching...
No Matches
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)
TemplateDocumentoperator= (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 TemplateDocumentCreateInternal (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

◆ Result

Enumerator
eSuccess 
eIncomplete 
eFailure 

Definition at line 30 of file TemplateDocument.h.

Constructor & Destructor Documentation

◆ TemplateDocument() [1/3]

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

◆ TemplateDocument() [2/3]

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

◆ TemplateDocument() [3/3]

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

◆ ~TemplateDocument()

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

Member Function Documentation

◆ CancelConversion()

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

Cancel the current template filling, forcing FillTemplateJson to return.

◆ CreateInternal()

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

◆ Destroy()

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

◆ FillTemplateJson()

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

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

Parameters
jsonA JSON dictionary mapping template keys to their replacement content.
Returns
The PDFDoc from the template filling result.

◆ FillTemplateJsonToOffice()

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
jsonA JSON dictionary mapping template keys to their replacement content.
output_pathThe path where the output file is written.

◆ FillTemplateJsonToOfficeWithFilter()

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
jsonA JSON dictionary mapping template keys to their replacement content.
output_streamAn output stream.

◆ GetConversionStatus()

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

Get the state of the template filling process.

Returns

◆ GetErrorString()

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.

◆ GetHandleInternal()

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

◆ GetNumWarnings()

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.

◆ GetTemplateKeysJson()

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.

◆ GetWarningString()

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
indexThe index of the string to be retrieved. Must be less than GetNumWarnings().
Returns
The value of the particular warning string.

◆ IsCancelled()

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

Has the template filling been cancelled?.

Returns
Returns true if CancelConversion has been called previously.

◆ operator=()

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

Member Data Documentation

◆ m_impl

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: