Printing and Output

Native C API

Select output settings and generate output from a stand-alone or Repository based FormLayout.

Overview

The native C API uses an instance handle returned by TFormer_Init. Use this handle to select a stand-alone or Repository based FormLayout, provide data and generate output. No separate Job or JobData objects are required.

You can select the output type and destination (Printing and Export), set output options (Print Options), and select a configuration file (TFORMer.XML Configuration File).

Workflow

The basic steps to generate output are as follows:

  1. Initialize an instance with TFormer_Init and check the returned handle.

  2. Select the layout with TFormer_SetRepositoryName. For a repository, also select the project and form with TFormer_SetProjectName and TFormer_SetFormName.

  3. Select the output type and destination; see Printing and Export. Set any options needed for data handling before supplying data.

  4. Provide records and field values, import data, or use a data source defined in the layout; see JobData.

  5. Generate output with TFormer_Print, or use TFormer_PrintToStream for an application-provided output callback.

  6. Release the instance with TFormer_Exit, including after an error.

Check the return code of each operation before continuing; see Error-Handling. Native setters take effect when called. Select the layout before supplying data. If you use a layout-defined data source, select it before setting its parameters. Changing the selection can discard cached records. For the interaction of output type, printer name and output name, see Combining Output Settings.

More Information

  • JobData
    Providing data to the native instance

NameKindPurpose
EWriteCallBackenum Enumerations used in the TFN_StreamWriteCallback function.
ETFPrintResultTypeenum Describes the data that should be stored while generating the output.
TFN_StreamWriteCallbacktypedef Callback function for streamed output.
TFormer_SetRepositoryNamefunction Sets the filename of the Repository or the filename of the stand-alone FormLayout for this Job.
TFormer_SetPrinterTypefunction Sets the type of the generated output.
TFormer_SetPrinterNamefunction Sets the name of the output device (file or printer).
TFormer_SetJobTrayControlNamefunction Sets the name of the JobTrayControl to be used for this Job.
TFormer_SetProjectNamefunction Specifies the Project-name for printing a Repository-based FormLayout.
TFormer_SetFormNamefunction Specifies the name of the Repository-based FormLayout.
TFormer_SetNumberOfCopiesfunction Sets the number of document copies to be printed.
TFormer_SetStartRowColumnfunction Selects the starting cell of the first label to be printed.
TFormer_SetOutputNamefunction Sets the name of the output file or the name of the spool-job (on Microsoft Windows printers).
TFormer_SetPageFromTofunction Sets the range of page-numbers to be the printed.
TFormer_SetPrintOptionsfunction Sets additional options for printing and output generation.
TFormer_SetConfigFilefunction Sets the configuration file for TFORMer SDK.
TFormer_Printfunction Prints the current FormLayout using the adjusted DataSource.
TFormer_PrintToStreamfunction Generates output through a callback using the current FormLayout with the adjusted DataSource.
TFormer_SetPrintResultTypefunction Set the type of data that should be gathered, while printing.
TFormer_GetPrintResultfunction Gets the data of the last print operation in specified format.

EWriteCallBack

enum EWriteCallBack

Enumerations used in the TFN_StreamWriteCallback function.

The TFN_StreamWriteCallback is required only when generating output as in-memory stream(s).

NameInitializerDescription
eWriteCallBack_Open= 1

Event for opening a stream.

pData points to the name of the stream which is an UTF-8 encoded string

eWriteCallBack_Data= 2

Event for new stream-data.

pData points to the available data.

eWriteCallBack_Close= 3

Event for closing a stream.

pData is NULL

ETFPrintResultType

enum ETFPrintResultType

Describes the data that should be stored while generating the output.

After the output has been generated the data can be retrieved by a call to TFormer_GetPrintResult.

NameInitializerDescription
eTFPrintResultType_None= 0

No data should be generated.

eTFPrintResultType_Basic

Only basic information should be generated.

eTFPrintResultType_Medium

Additional data will be stored.

eTFPrintResultType_Full

All information possible will be stored and is available after output generation.

TFN_StreamWriteCallback

typedef ERRCODE(* TFN_StreamWriteCallback) (BYTE *pData, INT nSizeData, DWORD eWriteCallback, LPARAM lParam);

Callback function for streamed output.

If output is generated to an in-memory stream this function is required. It is called multiple times during the lifetime of a stream.

Returns

ErrOk (0) in case of success, non-zero if an error occurred

Parameters

Parameter / typeDescription
pData


The buffer holds either the stream name (UTF-8), or the stream data (see EWriteCallBack)

nSizeData


Number of valid bytes

eWriteCallback

The type of the callback event (open, data, close) - see EWriteCallBack

lParam


User data provided by a call to TFormer_PrintToStream

Search documentation

Search in
More scopes
Additional scopes

All contents