Install TFORMer Designer and TFORMer Runtime using the setup application. Besides TFORMer Designer (the graphical layout editor) the setup-application installs TFORMer Runtime. TFORMer Runtime is available as DLL, as COM component, as .NET assembly and as stand-alone application (TFPrint). Both the COM component and the .NET assembly of TFORMer Runtime are registered automatically. The .NET assembly is automatically placed in the GAC.
Use TFORMer Designer to create a FormLayout graphically.
In most cases your FormLayout contains dynamic data which is provided by your application during print-time (e.g. an article number for a product label or a ticket-number for an eTicket). TFORMer uses DataFields as place-holders for such dynamic data. These DataFields are declared as well as used within the FormLayout.
For testing purposes TFORMer Designer allows you to provide values for such DataFields manually or to import them from files or data-bases. Testing a FormLayout can therefore be done without any line of code.
Depending on your application choose between stand-alone FormLayouts or Repository-based FormLayouts:
Create a new C or C++ project (or choose any programming language which is able to use DLLs or shared libraries).
TFormer6.h and to define the preprocessor variable TECIT_DLLIMPORT: #define TECIT_DLLIMPORT #include "TFormer6.h" #undef TECIT_DLLIMPORT
#define TECIT_DLLIMPORT #define _TEC_UNIX #define TEC_UNIX_BUILD #include <TECITStd/TECITStd.h> #include <TFormer6.h> #undef TECIT_DLLIMPORT #undef TECIT_DLLIMPORT #undef _TEC_UNIX #undef TEC_UNIX_BUILD
$ gcc TFORMerSimpleX.c -o TFORMerSimpleX -ldl -lTFormer6 -L/usr/local/lib -I/usr/local/include
Licensing is not required for evaluation purposes. For production use it is a must to apply a license key to TFORMer Runtime before using any other properties or methods of TFORMer. This needs to be done only once, for example when initializing the application.
TFormer_License ("John Doe", LICKIND_WORKSTATION, 1, "LicenseKey"); /* Pass license key */
Now initialize TFORMer Runtime:
HTFORM hTForm = TFormer_Init (NULL); /* Allocate memory and retrieve TFORMer handle (pointer) */ if (!hTForm) return;
When you want to use a Repository based FormLayout (*.tfr), you have to specify the Repository, the Project and the name of the FormLayout:
eCode = TFormer_SetRepositoryName (hTForm, "C:/ProgramData/TEC-IT/TFormer6/Samples/Demo Repository/Demos.tfr"); eCode = TFormer_SetProjectName (hTForm, "TFORMer_Runtime_Examples"); eCode = TFormer_SetFormName (hTForm, "BarcodeLabels");
When using a stand-alone FormLayout (.tff) only one function call is required:
eCode = TFormer_SetRepositoryName (hTForm, "C:/SomePath/BarcodeLabels.tff");
As mentioned above a FormLayout usually contains DataFields which are used as place holders for dynamic data. Before printing a FormLayout you need to provide data for these DataFields. The required data can be passed to TFORMer using different methods:
This is the most direct method to pass data to TFORMer Runtime. In this case the developer provides names and values for the DataFields used in a FormLayout directly. The example below sets the values for the DataFields ArticleNo, ArticleName and ArticlePrice:
eCode = TFormer_ResetData (hTForm); /* Clear the data cache */ eCode = TFormer_NewRecord (hTForm); /* Add one record */ eCode = TFormer_SetVarValue (hTForm, "ArticleNo", "20021001"); /* Set the value of the DataField ArticleNo */ eCode = TFormer_SetVarValue (hTForm, "ArticleName", "Sound Blaster Audigy 2"); /* Set the value of the DataField ArticleName */ eCode = TFormer_SetVarValue (hTForm, "ArticlePrice", "175"); /* Set the value of the DataField ArticlePrice */
TFORMer Runtime is able to import data from text-/XML-files or from a database (ODBC). The filenames, DSNs or SQL-SELECT statements are specified directly. Take care, that the field-names available in the DataSource (e.g. the column names returned by a SQL-SELECT statement) are equal to the names of the DataFields used in a FormLayout.
/* Use the XML file InputData.XML as DataSource */ eCode = TFormer_SetXmlDataFile (hTForm, "/YourPath/InputData.XML");
/* Use the txt file InputData.txt as DataSource, using ';' as column separator, and '"' as text qualifier */ eCode = TFormer_SetTxtDataFile (hTForm, "/YourPath/InputData.txt", ';', '"');
/* retrieve data from myDSN */ eCode = TFormer_SetODBCData (hTForm, "myDSN", "user", "password", "SELECT * FROM myTable");
DataSources can also be defined by the user with TFORMer Designer as part of a FormLayout. Such a DataSource defines how data is retrieved (e.g. from an ODBC database), the field-mappings and optional DataSource parameters. If you want to use such a DataSource, select it by name as shown below. Use optional DataSource parameters to control certain aspects during runtime (e.g. filenames, SQL statement or an ODBC-DSN).
/* retrieve data using the predefined datasource myTextDataSource */ eCode = TFormer_SetDatasourceName (hTForm, "myTextDataSource"); /* set the value of the user-defined DataSource-Parameter parFile (defined in myTextDataSource) */ eCode = TFormer_SetDSParameterValue (hTForm, "parFile", "/YourPath/InputData.txt");
If functions are requesting filenames (e.g. TFormer_SetRepositoryName, TFormer_SetTxtDataFile, TFormer_SetXmlDataFile, TFormer_SetConfigFile), these may be passed in the following ways:
BASE64:. When passing a zipped file TFORMer expects a real WinZip compatible format. A zipped stream is not suitable! For more details please refer to TFORMer Developer Manual and ZIP and BASE64 Handling.To use the default printer of the current user specify NULL as printer name.
eCode = TFormer_SetPrinterName (hTForm, NULL, NULL); /* select the default printer of the system */ eCode = TFormer_Print (hTForm); /* print ! */
Instead of sending the form to a printer, you can export the output as a PDF, PostScript, HTML, ASCII or image file. ZPL-II is supported too (the ZEBRA printer language). The procedure is the same as printing the form – but instead of setting a printer name, set the name and type of the output file:
eCode = TFormer_SetPrinterType (hTForm, ePrinterType_PDFFile )); /* set the printer type to pdf */ eCode = TFormer_SetOutputName (hTForm, "TFORMer.pdf" )); /* write to the file TFORMer.pdf */ eCode = TFormer_Print (hTForm); /* print ! */
Clean up all resources allocated by TFORMer Runtime:
TFormer_Exit (hTForm) /* Free the TFORMer handle */
| © 2006-2010 - all rights reserved by TEC-IT Datenverarbeitung GmbH |
![]() |
| Generated on Wed Aug 17 13:20:39 2011 for TFORMer Runtime DLL/Shared Library with doxygen 1.6.3 |