TFPrint Samples

Sample Catalog

Install TFPrint and the supplied samples as described for Windows or Linux. For a first PDF, use the examples below with their supplied repository and data files. When adapting them to your own layout, keep the imported field names consistent with that layout; see Working with Data.

Windows

Create Barcode Labels as PDF from CSV Data

The installed BarcodeLabelsPDF sample loads Demos.tfr, selects project TFORMer_Runtime_Examples and form BarcodeLabels, imports BarcodeLabelsData.txt as delimited text, and creates Output.pdf. The following syntax is for Windows Command Prompt (cmd.exe) or a .bat file; ^ continues a command on the next line.

TFPrint.exe ^
  -F "<ExamplesDirectory>\Demo Repository\Demos.tfr" ^
     TFORMer_Runtime_Examples BarcodeLabels ^
  -O "<OutputDirectory>\Output.pdf" ^
  -OT PDF ^
  -D "<CommandLineSamples>\BarcodeLabelsPDF\BarcodeLabelsData.txt" ^
  -DT TEXT -DO SC, QC\"

The supplied batch file resolves these placeholders for the installed SDK. Find it and the other command-line samples under C:\ProgramData\TEC-IT\TFORMer\9\Examples\Command Line\.

To run the command shown above yourself, replace <ExamplesDirectory> with the installed Examples directory, <CommandLineSamples> with its Command Line subdirectory, and <OutputDirectory> with an existing writable directory. Run it from the SDK's Bin directory or use the full path to TFPrint.exe. On success, open Output.pdf in the selected output directory.

The following variant uses the same repository, CSV data, and directory placeholders as the PDF example. It sends output through Windows GDI to the current user's default printer:

TFPrint.exe ^
  -F "<ExamplesDirectory>\Demo Repository\Demos.tfr" ^
     TFORMer_Runtime_Examples BarcodeLabels ^
  -OT WIN32 ^
  -D "<CommandLineSamples>\BarcodeLabelsPDF\BarcodeLabelsData.txt" ^
  -DT TEXT -DO SC, QC\"

For a named printer, insert -O "YOUR_WINDOWS_PRINTER" ^ on a separate line before the -D line, replacing the placeholder with its installed Windows printer name. Keep the -DT TEXT -DO SC, QC\" line last. With -OT WIN32, -O selects the printer, not an output file; omitting it uses the default printer. For a shared Windows printer, the name can use the Windows form \\server\printername. The printer must be available to the account running TFPrint. The installed BarcodeLabelsPrinter batch sample also demonstrates direct printing.

Linux

Run these scripts from a writable working directory. The $ marks the shell prompt and is not part of the command.

Create PDFs from All Templates

To generate a PDF for every form layout in the Templates directory, run:

$ sh /usr/local/share/TFORMer9/Demos/DemoPDF.sh

The resulting PDF files are created in your current working directory. Generating PDFs for all templates can require several megabytes of disk space.

Create Barcode Labels as PDF

This script generates barcode labels in PDF format:

$ sh /usr/local/share/TFORMer9/Demos/DemoBarcodeLabels.sh

The packaged script loads Demos.tfr from the installed Demo Repository, selects project TFORMer_Runtime_Examples and form BarcodeLabels, and writes BarcodeLabels.pdf to the current working directory.

This variant uses the same installed demo repository and its default data as DemoBarcodeLabels.sh. CUPS must be installed and the named queue must be available to the account running TFPrint. Replace YOUR_CUPS_QUEUE with the configured queue name:

/usr/local/bin/tfprint \
  -F "/usr/local/share/TFORMer9/Examples/Demo Repository/Demos.tfr" \
     TFORMer_Runtime_Examples BarcodeLabels \
  -OT CUPS -O "YOUR_CUPS_QUEUE"

Both printer variants create a print job rather than a PDF file. Check the command's exit status, then the selected printer queue and printed output. Windows uses WIN32; Linux uses CUPS.

Additional Linux Examples

These examples use the layouts and files named in each command. Run them from a writable working directory containing the local files, or supply their actual paths. The installed version-9 paths shown below are retained for the supplied examples.

Print a Repository Form with Default Data

tfprint -F "/usr/local/share/TFORMer9/Examples/Demo Repository/Demos.tfr" TFORMer_Runtime_Examples BarcodeLabels

This uses the operating system's default printer path. See Print to a Printer for the distinction from an explicitly named CUPS queue.

Create a Repository PDF

tfprint -F Demos.tfr TFORMer_Runtime_Examples BarcodeLabels -OT PDF -O BarcodeLabels.pdf

Create a PDF from Semicolon-Separated Data

tfprint -F TFORMer.tff -DT TEXT -D TFORMer.csv -DO "Sc;" -OT PDF -O output.pdf

Transform XML with XSLT

tfprint -F TFORMer.tff -D data.xml -DT XML -DO XSLT:data.xsl -OT PDF -O output.pdf

The standalone layout uses the XML data transformed by data.xsl; see XML data options.

Select an Alternate Configuration File

tfprint -F Demos.tfr TFORMer_Runtime_Examples BarcodeLabels -OT PDF -O BarcodeLabels.pdf -CONFIG settings.xml

This selects a form in the repository Demos.tfr and uses settings.xml instead of the default configuration lookup. See Selecting a Configuration File.

Create a Multi-Page TIFF File

tfprint -F "/usr/local/share/TFORMer9/Examples/Demo Repository/Demos.tfr" TFORMer_Runtime_Examples BarcodeLabels -OT IMGMULTITIF -O output.tif

HTML and PostScript File Output

For XML file input, supply -D TFORMer.xml and -DT XML with the standalone layout. Select -OT HTML and -O output.html for HTML output, or -OT PS and -O output.ps for a PostScript file. The supplied input filenames stand for your layout and XML data; see Data Input and Output Target.

With multi-page HTML output, output.html is the index and page files are placed in output_pages. Single-document HTML output uses the selected output file instead. Keep the generated HTML resources together. For CUPS printing with XML input, use the same data-input options with the named-queue command under Linux.

Check X Display Resolution

On systems using an X display, the existing diagnostic example is:

xdpyinfo | grep resolution

For HTML output settings, see Output Configuration and resolution. The configuration supplied with your SDK version determines its defaults.

Installed Windows Batch Files

The following listings are the supplied batch files and input data. Keep each sample folder and its sibling Tools folder together. These installed examples are separate from the Product Label Quick Start. Their existing commands are shown unchanged; the sample checks are described under Paths and Error Checks.

BarcodeLabelsPDF

TFORMer SDK - Barcode Labels as PDF

Purpose:

This sample application uses TFPrint to generate a PDF document based on a form-layout. The used form-layout is named BarcodeLabels and is part of the installed Demo Repository. The data used for the labels is imported from BarcodeLabelsData.txt.

The output file is stored in the users temp-folder: C:\Users\YOURUSER\AppData\Local\Temp\output.pdf

Trying this sample:

  • Simply run the BarcodeLabelsPDF.bat file (double-click the file)

Installed files: BarcodeLabelsData.txt, BarcodeLabelsPDF.bat, README.txt.

BarcodeLabelsPDF.bat

@echo off
echo ************************************************************
echo   (c) 2006-2026 TEC-IT Datenverarbeitung GmbH
echo   www.tec-it.com
echo   office@tec-it.com
echo ************************************************************
echo   Sample for generating a PDF document with "TFPrint.exe"
echo   - Layout is taken from pre-installed demo repository
echo   - Data will be imported from file "BarcodeLabelsData.txt"
echo   - Output file name is "Output.PDF"
echo ************************************************************
echo.

call "%~dp0\..\Tools\CheckPath.cmd"
if %ERRORLEVEL% EQU 0 goto :FILE

:TFPrintMissing
echo.
echo ************************************************************
echo ERROR!
echo TFPrint.exe not found in PATH or default installation directory!
echo If you just installed TFORMer you can try rebooting your computer.
echo ************************************************************
goto :ENDSCRIPT

:FILE
set FILE="%~dp0\..\..\Demo Repository\Demos.tfr"
set FILE=%FILE:\\=\%

if exist %FILE% goto :TEMP

echo.
echo ************************************************************
echo ERROR!
echo Missing Demo-Repository (containing the Formlayouts)!
echo Could not find %FILE%
echo ************************************************************
goto :ENDSCRIPT

:TEMP
set TECITOUT=%TEMP%
if q%TECITOUT%==q set TECITOUT=%TMP%
if NOT q%TECITOUT%==q goto :OK

echo.
echo ************************************************************
echo ERROR!
echo A temporary directory for storing the output is required!
echo The environment-variable TEMP or TMP must be set!
echo ************************************************************
goto :ENDSCRIPT

:OK
if exist %TECITOUT%\Output.pdf del /F %TECITOUT%\Output.pdf

TFPrint.exe -F %FILE% TFORMer_Runtime_Examples BarcodeLabels -D "%~dp0\BarcodeLabelsData.txt" -DT TEXT -DO SC, QC\" -O %TECITOUT%/"Output.pdf" -OT PDF

start %TECITOUT%/Output.pdf

:ENDSCRIPT
set FILE=
set TECITOUT=
pause

BarcodeLabelsData.txt

"ArticleNo","ArticleName","ArticlePrice"
"100001","HP OfficeJet 5610","142.95"
"100002","HP Photosmart 2575","194.95"
"100003","Canon BCI-11","19.95"
"100004","Canon BCI-24","10.95"
"100005","Epson #T027201","27.95"
"100006","Lexmark 70","31.95"
"100007","HP 99 #C9369WN","26.95"

BarcodeLabelsPrinter

TFORMer SDK - Barcode Labels on default Printer

Purpose:

This sample application uses TFPrint to print document based on a form-layout. The used form-layout is named BarcodeLabels and is part of the installed Demo Repository. The data used for the labels is imported from BarcodeLabelsData.txt.

Notes:

  • This example needs at least one installed printer (default printer for the current user)!

Trying this sample:

  • Simply run the BarcodeLabelsPrinter.bat file (double-click the file)

Installed files: BarcodeLabelsData.txt, BarcodeLabelsPrinter.bat, README.txt.

BarcodeLabelsPrinter.bat

@echo off
echo ************************************************************
echo   (c) 2006-2026 TEC-IT Datenverarbeitung GmbH
echo   www.tec-it.com
echo   office@tec-it.com
echo ************************************************************
echo   Sample for generating a PDF document with "TFPrint.exe"
echo   - Layout is taken from pre-installed demo repository
echo   - Data will be imported from file "BarcodeLabelsData.txt"
echo   - Output will be printed on default printer
echo ************************************************************
echo.

call "%~dp0\..\Tools\CheckPath.cmd"
if %ERRORLEVEL% EQU 0 goto :FILE

:TFPrintMissing
echo.
echo ************************************************************
echo ERROR!
echo TFPrint.exe not found in PATH or default installation directory!
echo If you just installed TFORMer you can try rebooting your computer.
echo ************************************************************
goto :ENDSCRIPT

:FILE
set FILE="%~dp0\..\..\Demo Repository\Demos.tfr"
set FILE=%FILE:\\=\%

if exist %FILE% goto :OK

echo.
echo ************************************************************
echo ERROR!
echo Missing Demo-Repository (containing the Formlayouts)!
echo Could not find %FILE%
echo ************************************************************
goto :ENDSCRIPT

:OK
TFPrint.exe -F %FILE% TFORMer_Runtime_Examples BarcodeLabels -D "%~dp0\BarcodeLabelsData.txt" -DT TEXT -DO SC, QC\"

if ERRORLEVEL 1 echo Printing failed! Please check if there is a default printer on your system.

:ENDSCRIPT
set FILE=
pause

BarcodeLabelsData.txt

"ArticleNo","ArticleName","ArticlePrice"
"100001","HP OfficeJet 5610","142.95"
"100002","HP Photosmart 2575","194.95"
"100003","Canon BCI-11","19.95"
"100004","Canon BCI-24","10.95"
"100005","Epson #T027201","27.95"
"100006","Lexmark 70","31.95"
"100007","HP 99 #C9369WN","26.95"

ODBC Examples

ODBCReportPDF

TFORMer SDK - Simple Report with an ODBC DataSource

Purpose:

This sample application uses TFPrint to generate a PDF-document based on a form-layout. The used form-layout is named ODBCReportPDF.tff. The data is read via an ODBC connection (installed by the setup) and the underlying database ODBCReportPDF.mdb.

Trying this sample:

  • Simply run the ODBCReportPDF.bat file (double-click the file)

Installed files: ODBCReportPDF.bat, ODBCReportPDF.in, ODBCReportPDF.mdb, ODBCReportPDF.tff, README.txt.

This sample uses direct -DT ODBC input. The batch file selects ODBCReportPDF.in with -C; that command file supplies the layout, the TFORMer_Sample DSN and the SQL query for ODBCReportPDF.mdb. The installed DSN is separate from a data source configured in a layout; PickingListPDF uses the latter mechanism. Use the ODBC driver architecture matching the TFPrint executable. See Windows deployment.

ODBCReportPDF.bat

@echo off
echo ************************************************************
echo   (c) 2006-2026 TEC-IT Datenverarbeitung GmbH
echo   www.tec-it.com
echo   office@tec-it.com
echo ************************************************************
echo   Sample for generating a PDF document with "TFPrint.exe"
echo   - Some of the TFPrint command line parameters are stored in
echo      the command file ODBCReportPDF.in
echo   - Layout is taken from pre-installed form ODBCReportPDF.tff
echo   - Data will be imported from ODBC connection TFORMer_Sample
echo   - Output file name is "Output.PDF"
echo ************************************************************
echo.

call "%~dp0\..\Tools\CheckPath.cmd"
if %ERRORLEVEL% NEQ 0 goto :TFPrintMissing

set TECITOUT=%TEMP%
if q%TECITOUT%==q set TECITOUT=%TMP%
if q%TECITOUT%==q goto :TempDirMissing

if exist %TECITOUT%\Output.pdf del /F %TECITOUT%\Output.pdf

if exist "%ProgramFiles%\Microsoft Office" (
  TFPrintx64.exe -C "%~dp0\ODBCReportPDF.in" -O %TECITOUT%/Output.pdf -OT PDF
) else if exist "%ProgramFiles(x86)%\Microsoft Office" (
  TFPrintx32.exe -C "%~dp0\ODBCReportPDF.in" -O %TECITOUT%/Output.pdf -OT PDF
) else (
  goto :OfficeMissing
)

start %TECITOUT%/Output.pdf

goto :ENDSCRIPT


:TFPrintMissing
echo.
echo ************************************************************
echo ERROR!
echo TFPrint.exe not found in PATH or default installation directory!
echo If you just installed TFORMer you can try rebooting your computer.
echo ************************************************************
goto :ENDSCRIPT

:TempDirMissing
echo.
echo ************************************************************
echo ERROR!
echo A temporary directory for storing the output is required!
echo The environment-variable TEMP or TMP must be set!
echo ************************************************************
goto :ENDSCRIPT

:OfficeMissing
echo.
echo ************************************************************
echo ERROR!
echo Microsoft Office not found!
echo This sample requires Microsoft Access ODBC driver!
echo ************************************************************
goto :ENDSCRIPT

:ENDSCRIPT
set TECITOUT=
pause

ODBCReportPDF.in

-F ODBCReportPDF.tff
-DT ODBC 
-DO DSN:DSN=TFORMer_Sample
SQL:"SELECT * FROM tbl_Example"

PickingListPDF

TFORMer SDK - Print Picking List as PDF

Purpose:

This sample application uses TFPrint to generate a PDF document based on a form-layout. The used form-layout is a Picking List and is similar to the Picking List in the pre-installed Templates. The data is read via the ODBC connection TFORMer_Sample (installed by the setup). The SQL-statement to retrieve the data is customized with a Source-Parameter (see Layout).

The output file is stored in the users temp-folder: C:\Users\YOURUSER\AppData\Local\Temp\output.pdf

Trying this sample:

  • Simply run the PickingListPDF.bat file (double-click the file)

Installed files: PickingListPDF.bat, PickingListSample.tff, README.txt, Tec-it Logo.bmp.

The batch file asks for a picking-list number (1–3), passes it as PickingListParameter, and selects TFPrintx64.exe or TFPrintx32.exe according to the installed Microsoft Office directory. The file requires the Microsoft Access ODBC driver. Review this installed selection if the driver and Office installation differ.

PickingListPDF.bat

@echo off
echo ************************************************************
echo   (c) 2006-2026 TEC-IT Datenverarbeitung GmbH
echo   www.tec-it.com
echo   office@tec-it.com
echo ************************************************************
echo   Sample for generating a PDF document with "TFPrint.exe"
echo   - Layout is taken from pre-installed templates
echo   - Data will be imported from ODBC connection TFORMer_Sample
echo   - Output file name is "Output.PDF"
echo ************************************************************
echo.

call "%~dp0\..\Tools\CheckPath.cmd"
if %ERRORLEVEL% NEQ 0 goto :TFPrintMissing

set FILE="%~dp0\PickingListSample.tff"
set FILE=%FILE:\\=\%

if not exist %FILE% goto :LayoutMissing

set TECITOUT=%TEMP%
if q%TECITOUT%==q set TECITOUT=%TMP%
if q%TECITOUT%==q goto :TempDirMissing

SET /P PickingListNo=Enter the number of the Picking List you want to print (1-3): 

if exist %TECITOUT%\Output.pdf del /F %TECITOUT%\Output.pdf

if exist "%ProgramFiles%\Microsoft Office" (
  TFPrintx64.exe -F %FILE% -D ODBC -DT DATASOURCE -DO PickingListParameter:%PickingListNo% -O %TECITOUT%/"Output.pdf" -OT PDF
) else if exist "%ProgramFiles(x86)%\Microsoft Office" (
  TFPrintx32.exe -F %FILE% -D ODBC -DT DATASOURCE -DO PickingListParameter:%PickingListNo% -O %TECITOUT%/"Output.pdf" -OT PDF
) else goto :OfficeMissing

start %TECITOUT%\Output.pdf

goto :ENDSCRIPT


:TFPrintMissing
echo.
echo ************************************************************
echo ERROR!
echo TFPrint.exe not found in PATH or default installation directory!
echo If you just installed TFORMer you can try rebooting your computer.
echo ************************************************************
goto :ENDSCRIPT

:LayoutMissing
echo.
echo ************************************************************
echo ERROR!
echo Missing Picking List Layout!
echo Could not find %FILE%
echo ************************************************************
goto :ENDSCRIPT

:TempDirMissing
echo.
echo ************************************************************
echo ERROR!
echo A temporary directory for storing the output is required!
echo The environment-variable TEMP or TMP must be set!
echo ************************************************************
goto :ENDSCRIPT

:OfficeMissing
echo.
echo ************************************************************
echo ERROR!
echo Microsoft Office not found!
echo This sample requires Microsoft Access ODBC driver!
echo ************************************************************
goto :ENDSCRIPT

:ENDSCRIPT
set FILE=
set TECITOUT=
set PickingListNo=
pause

Direct ODBC Input on Linux

The installed man-page example uses a MySQL table and a unixODBC data source named TFORMer. A MySQL ODBC driver must already be installed and configured. The SQL columns returned by the query must match the data fields in BarcodeLabels. These are the historical example values; adapt the server and driver settings to your installation.

tfprint -F "/usr/local/share/TFORMer9/Examples/Demo Repository/Demos.tfr" \
TFORMer_Runtime_Examples BarcodeLabels -DT ODBC -DO DSN:"DSN=TFORMer" \
USER:root SQL:"SELECT * FROM tbl_Example" -O output.pdf -OT PDF
mysql -u root -p
mysql> use test;
mysql> CREATE TABLE tbl_Example ( ArticleName VARCHAR(50), ArticlePrice NUMERIC(10,2), PRIMARY KEY( ArticleName ) );
mysql> INSERT INTO tbl_Example VALUES( 'Article1', 10.50 );
mysql> INSERT INTO tbl_Example VALUES( 'Article2', 3.14);
mysql> INSERT INTO tbl_Example VALUES( 'The Ultimate Answer to Life, The Universe, and Everything.', 42.00 );

The last supplied name exceeds the shown VARCHAR(50) length; adapt the sample value or column length before running it. The transcript is retained as an example, not a successful run on your database.

Configure the DSN in the unixODBC configuration file used by your installation. The original example names /etc/unixODBC/odbc.ini on SuSE Linux and /etc/odbc.ini on other UNIX systems:

[TFORMer]
Description     = MySQL TFORMer ODBC Test
Driver          = MySQL
Server          = localhost
Database        = test
Port            = 3306
Socket          = /var/lib/mysql/mysql.sock
Option          =
Stmt            =

HTTP Layout Example

**TFORMer SDK - Simple Web-based PDF Report **

Purpose:

This sample application uses TFPrint to generate a PDF document based on a form-layout stored on https://www.tec-it.com. The used form-layout is named OnlineReport_1.tff. The data used for this report is imported from HTTPReportPDF.xml.

The output file is stored in the users temp-folder: C:\Users\YOURUSER\AppData\Local\Temp\output.pdf

Notes:

  • An internet-connection is required for this exmaple!

Trying this sample:

  • Simply run the HTTPReportPDF.bat file (double-click the file)

Installed files: HTTPReportPDF.bat, HTTPReportPDF.xml, README.txt.

This Windows sample combines an HTTPS layout URL with local XML input. It requires access to the supplied URL. If the remote layout is unavailable, download it beforehand and use its local path; see Direct URL access.

HTTPReportPDF.bat

@echo off
echo ************************************************************
echo   (c) 2006-2026 TEC-IT Datenverarbeitung GmbH
echo   www.tec-it.com
echo   office@tec-it.com
echo ************************************************************
echo   Sample for generating a PDF document with "TFPrint.exe"
echo   - Layout is taken from:
echo      https://www.tec-it.com/onlinesamples/tformer/reports/OnlineReport_1.tff
echo   - Data will be imported from file "HTTPReportPDF.xml"
echo   - Output file name is "Output.PDF"
echo ************************************************************
echo.

call "%~dp0\..\Tools\CheckPath.cmd"
if %ERRORLEVEL% EQU 0 goto :FILE

:TFPrintMissing
echo.
echo ************************************************************
echo ERROR!
echo TFPrint.exe not found in PATH or default installation directory!
echo If you just installed TFORMer you can try rebooting your computer.
echo ************************************************************
goto :ENDSCRIPT

:FILE
set TECITOUT=%TEMP%
if q%TECITOUT%==q set TECITOUT=%TMP%
if NOT q%TECITOUT%==q goto :OK

echo.
echo ************************************************************
echo ERROR!
echo A temporary directory for storing the output is required!
echo The environment-variable TEMP or TMP must be set!
echo ************************************************************
goto :ENDSCRIPT

:OK
if exist %TECITOUT%\Output.pdf del /F %TECITOUT%\Output.pdf

TFPrint.exe -F "https://www.tec-it.com/onlinesamples/tformer/reports/OnlineReport_1.tff" -D "%~dp0\HTTPReportPDF.xml" -DT XML -O %TECITOUT%/"Output.pdf" -OT PDF

start %TECITOUT%\Output.pdf

:ENDSCRIPT
set TECITOUT=
pause

HTTPReportPDF.xml

<?xml version="1.0"?>
<PSData>
    <Form>
        <Records>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
            <Record/>
        </Records>
        <ImportedVariables/>
    </Form>
</PSData>

Related Server Example

The version-9 Linux man page also lists /usr/local/share/TFORMer9/SampleCodeCGI/ as a PHP CGI example that invokes tfprint to create PDF output. This is a separate legacy server example; it is not HTTPReportPDF.bat. Its availability depends on the installed package. For runtime-account and file-access requirements, see Server and Web Applications.

VDA and Serial Letter

SerialLetterPDF

TFORMer SDK - Serial Letter as PDF

Purpose:

This sample application uses TFPrint to generate a PDF document based on a form-layout. The used form-layout is named MailingFlowerPower and is part of the installed Demo Repository. The data used for the Serial Letter is imported from SerialLetterData.csv.

The output file is stored in the users temp-folder: C:\Users\YOURUSER\AppData\Local\Temp\output.pdf

Trying this sample:

  • Simply run the SerialLetterPDF.bat file (double-click the file)

Installed files: README.txt, SerialLetterData.csv, SerialLetterPDF.bat.

SerialLetterPDF.bat

@echo off
echo ************************************************************
echo   (c) 2006-2026 TEC-IT Datenverarbeitung GmbH
echo   www.tec-it.com
echo   office@tec-it.com
echo ************************************************************
echo   Sample for generating a PDF document with "TFPrint.exe"
echo   - Layout is taken from pre-installed demo repository
echo   - Data will be imported from file "SerialLetterData.csv"
echo   - Output file name is "Output.PDF"
echo ************************************************************
echo.

call "%~dp0\..\Tools\CheckPath.cmd"
if %ERRORLEVEL% EQU 0 goto :FILE

:TFPrintMissing
echo.
echo ************************************************************
echo ERROR!
echo TFPrint.exe not found in PATH or default installation directory!
echo If you just installed TFORMer you can try rebooting your computer.
echo ************************************************************
goto :ENDSCRIPT

:FILE
set FILE="%~dp0\..\..\Demo Repository\Demos.tfr"
set FILE=%FILE:\\=\%

if exist %FILE% goto :TEMP

echo.
echo ************************************************************
echo ERROR!
echo Missing Demo-Repository (containing the Formlayouts)!
echo Could not find %FILE%
echo ************************************************************
goto :ENDSCRIPT

:TEMP
set TECITOUT=%TEMP%
if q%TECITOUT%==q set TECITOUT=%TMP%
if NOT q%TECITOUT%==q goto :OK

echo.
echo ************************************************************
echo ERROR!
echo A temporary directory for storing the output is required!
echo The environment-variable TEMP or TMP must be set!
echo ************************************************************
goto :ENDSCRIPT

:OK
if exist %TECITOUT%\Output.pdf del /F %TECITOUT%\Output.pdf

TFPrint.exe -F %FILE% TFORMer_Runtime_Examples MailingFlowerPower -D "%~dp0\SerialLetterData.csv" -DT TEXT -DO SC, QC\" -O %TECITOUT%/"Output.pdf" -OT PDF

start %TECITOUT%/Output.pdf

:ENDSCRIPT
set FILE=
set TECITOUT=
pause

SerialLetterData.csv

"Address","Salutation","City","CustNr","DateValid","Name","Zip"
"Main Street 6","Mr.","Nowhere","HS1234","12/31/2006","Jephen Stobs","12334"
"Side Street 7","Mrs.","Nowhere","HS6543","12/31/2006","Tus Nelda","12334"
"Some Street 5","Mr.","Nowhere","SO3342","12/31/2006","Silent Bob","12334"
"Down Street 1","Mr.","Nowhere","JM1234","12/31/2006","Je Me Hendrix","12334"
"Left Street 1","Mr.","Somewhere","GB1234","12/31/2006","Gill Bates","12334"
"Straight Street 1","Mr.","Elsewhere","LT4321","12/31/2006","Tinus Lor-Valds","12335"

VDA4994LabelPDF

TFORMer SDK - VDA 4994 V2.0 Label as PDF

Purpose:

This sample application uses TFPrint to generate a PDF document based on a form-layout. The used form-layout is a VDA 4994 V2.0 Label and is taken from the pre-installed Templates. The default data is used for this Label.

The output file is stored in the users temp-folder: C:\Users\YOURUSER\AppData\Local\Temp\output.pdf

Trying this sample:

  • Run VDA4994LabelPDF_EN.bat or VDA4994LabelPDF_DE.bat (double-click the file)

Installed files: README.txt, VDA4994LabelPDF_DE.bat, VDA4994LabelPDF_EN.bat, VDA_4994_V2_0_DE_A5.tff, VDA_4994_V2_0_DE_A5.xml, VDA_4994_V2_0_EN_A5.tff, VDA_4994_V2_0_EN_A5.xml.

VDA4994LabelPDF_DE.bat

@echo off
echo ************************************************************
echo   (c) 2006-2026 TEC-IT Datenverarbeitung GmbH
echo   www.tec-it.com
echo   office@tec-it.com
echo ************************************************************
echo   Sample for generating a PDF document with "TFPrint.exe"
echo   - Layout is taken from pre-installed templates
echo   - Default Data will be used
echo   - Output file name is "Output.PDF"
echo ************************************************************
echo.

call "%~dp0\..\Tools\CheckPath.cmd"
if %ERRORLEVEL% EQU 0 goto :FILE

:TFPrintMissing
echo.
echo ************************************************************
echo ERROR!
echo TFPrint.exe not found in PATH or default installation directory!
echo If you just installed TFORMer you can try rebooting your computer.
echo ************************************************************
goto :ENDSCRIPT

:FILE
set FILE="%~dp0\VDA_4994_V2_0_DE_A5.tff"
set FILE=%FILE:\\=\%

if exist %FILE% goto :TEMP

echo.
echo ************************************************************
echo ERROR!
echo Missing VDA 4994 V2.0 Label!
echo Could not find %FILE%
echo ************************************************************
goto :ENDSCRIPT

:TEMP
set TECITOUT=%TEMP%
if q%TECITOUT%==q set TECITOUT=%TMP%
if NOT q%TECITOUT%==q goto :OK

echo.
echo ************************************************************
echo ERROR!
echo A temporary directory for storing the output is required!
echo The environment-variable TEMP or TMP must be set!
echo ************************************************************
goto :ENDSCRIPT

:OK
if exist %TECITOUT%\Output.pdf del /F %TECITOUT%\Output.pdf

TFPrint.exe -F %FILE% -OT PDF -O %TECITOUT%\Output.pdf

start %TECITOUT%\Output.pdf

:ENDSCRIPT
set FILE=
set TECITOUT=
pause

VDA Input Fields (DE)

The supplied VDA_4994_V2_0_DE_A5.xml uses PSData, Form, Records, and one Record. Its field values are:

Field Supplied value
A1_Sender_Name_L1 LIEFERANT AG
A1_Sender_Name_L2 WERK BERLIN
A1_Sender_Location BERLIN
A1_Sender_Country DE
A1_Sender_Postal_Code 10117
A1_Sender_SupplierID 887766554
A1_Country_Of_Origin DE
A2_Receiver_Name_L1 KUNDE AG
A2_Receiver_Name_L2 WERK MUENCHEN
A2_Receiver_Address INDUSTRIEPARK 13
A2_Receiver_Country DE
A2_Receiver_Postal_Code 80888
A2_Receiver_Location MUENCHEN
A2_Plant 011
A2_Unloading_Point ABLAD123
A2_Storage LAGER7
A3_Label_Type M
B1_Delivery_Note 12345678
B1_Supplier_Number 987654321
B2_Routing_Information A1B2C3D4E5F6G7H8
B2_Point_of_Use LINE 15
B3_ETA_Date 2016-01-15
B3_ETA_Time 13:30
B3_Quantity 1000
B3_UoM ST
B3_Net_Weight 1200,8
B3_Gross_Weight 1210
C_Part_Number GFS-123-554-747
C_Part_Description STEUERGERÄT
C_Safety_Symbol 0
D1_PackageID_DI 1J
D1_PackageID_IAC UN
D1_PackageID_CIN 987654321
D1_PackageID_SN 000123456
D2_Packaging_Type 6280RL
D2_Shipment_Date 2016-01-14
D2_Expiry_Date (empty)
D2_Production_Date (empty)
D2_Batch_Number CH1234
D2_Number_of_Packages 40
D2_Engineering_Change E234567
D2_Hardware_Revision HH112233
D2_Software_Revision S123456
E1_Supplier_Data INHALT MUSS VOM LIEFERANTEN ANGEPASST WERDEN
E2_PCI16_L1 KUNDENDATEN ZEILE 1
E2_PCI16_L2 KUNDENDATEN ZEILE 2
E2_PCI16_L3 KUNDENDATEN ZEILE 3
E2_PCI16_L4 KUNDENDATEN ZEILE 4
E2_PCI16_L5 KUNDENDATEN ZEILE 5
E2_PCI3_L1 (empty)
E2_PCI3_L2 (empty)
E2_PCI3_L3 (empty)
E2_PCI3_L4 (empty)
E2_PCI3_L5 (empty)
E2_PCI3_L6 (empty)
E2_PCI3_L7 (empty)
E2_PCI3_L8 (empty)
E2_PCI3_L9 (empty)
E2_PCI3_L10 (empty)
B3_ETA_Text (empty)
B3_UoM_X12_3 (empty)
D1_LicensePlate (empty)
D2_Printed_Date_DE (empty)
D2_Printed_Date_Letter (empty)
D2_Printed_Date_Text (empty)

VDA4994LabelPDF_EN.bat

@echo off
echo ************************************************************
echo   (c) 2006-2026 TEC-IT Datenverarbeitung GmbH
echo   www.tec-it.com
echo   office@tec-it.com
echo ************************************************************
echo   Sample for generating a PDF document with "TFPrint.exe"
echo   - Layout is taken from pre-installed templates
echo   - Default Data will be used
echo   - Output file name is "Output.PDF"
echo ************************************************************
echo.

call "%~dp0\..\Tools\CheckPath.cmd"
if %ERRORLEVEL% EQU 0 goto :FILE

:TFPrintMissing
echo.
echo ************************************************************
echo ERROR!
echo TFPrint.exe not found in PATH or default installation directory!
echo If you just installed TFORMer you can try rebooting your computer.
echo ************************************************************
goto :ENDSCRIPT

:FILE
set FILE="%~dp0\VDA_4994_V2_0_EN_A5.tff"
set FILE=%FILE:\\=\%

if exist %FILE% goto :TEMP

echo.
echo ************************************************************
echo ERROR!
echo Missing VDA 4994 V2.0 Label!
echo Could not find %FILE%
echo ************************************************************
goto :ENDSCRIPT

:TEMP
set TECITOUT=%TEMP%
if q%TECITOUT%==q set TECITOUT=%TMP%
if NOT q%TECITOUT%==q goto :OK

echo.
echo ************************************************************
echo ERROR!
echo A temporary directory for storing the output is required!
echo The environment-variable TEMP or TMP must be set!
echo ************************************************************
goto :ENDSCRIPT

:OK
if exist %TECITOUT%\Output.pdf del /F %TECITOUT%\Output.pdf

TFPrint.exe -F %FILE% -OT PDF -O %TECITOUT%\Output.pdf

start %TECITOUT%\Output.pdf

:ENDSCRIPT
set FILE=
set TECITOUT=
pause

VDA Input Fields (EN)

The supplied VDA_4994_V2_0_EN_A5.xml uses PSData, Form, Records, and one Record. Its field values are:

Field Supplied value
A1_Sender_Name_L1 LIEFERANT AG
A1_Sender_Name_L2 WERK BERLIN
A1_Sender_Location BERLIN
A1_Sender_Country DE
A1_Sender_Postal_Code 10117
A1_Sender_SupplierID 887766554
A1_Country_Of_Origin DE
A2_Receiver_Name_L1 MODERN CAR INC.
A2_Receiver_Name_L2 LONDON PLANT
A2_Receiver_Address 72 GREAT PETER STREET
A2_Receiver_Country UK
A2_Receiver_Postal_Code SW1P 2BN
A2_Receiver_Location LONDON
A2_Plant 013
A2_Unloading_Point RAMP 15
A2_Storage WH4
A3_Label_Type M
B1_Delivery_Note 12345678
B1_Supplier_Number 987654321
B2_Routing_Information ROUTE 66
B2_Point_of_Use LINE 15
B3_ETA_Date 2016-01-15
B3_ETA_Time 13:30
B3_Quantity 1000
B3_UoM PC
B3_Net_Weight 1200,8
B3_Gross_Weight 1210
C_Part_Number GFS-123-554-747
C_Part_Description PART NAME
C_Safety_Symbol 0
D1_PackageID_DI 1J
D1_PackageID_IAC UN
D1_PackageID_CIN 987654321
D1_PackageID_SN 000123456
D2_Packaging_Type 0009PAL
D2_Shipment_Date 2016-01-14
D2_Expiry_Date (empty)
D2_Production_Date (empty)
D2_Batch_Number CH1234
D2_Number_of_Packages 40
D2_Engineering_Change E234567
D2_Hardware_Revision HH112233
D2_Software_Revision S123456
E1_Supplier_Data CONTENT MUST BE DEFINED BY SUPPLIER
E2_PCI16_L1 CUSTOMER DATA LINE 1
E2_PCI16_L2 CUSTOMER DATA LINE 2
E2_PCI16_L3 CUSTOMER DATA LINE 3
E2_PCI16_L4 CUSTOMER DATA LINE 4
E2_PCI16_L5 CUSTOMER DATA LINE 5
E2_PCI3_L1 (empty)
E2_PCI3_L2 (empty)
E2_PCI3_L3 (empty)
E2_PCI3_L4 (empty)
E2_PCI3_L5 (empty)
E2_PCI3_L6 (empty)
E2_PCI3_L7 (empty)
E2_PCI3_L8 (empty)
E2_PCI3_L9 (empty)
E2_PCI3_L10 (empty)
B3_ETA_Text (empty)
B3_UoM_X12_3 (empty)
D1_LicensePlate (empty)
D2_Printed_Date_EN (empty)
D2_Printed_Date_Letter (empty)
D2_Printed_Date_Text (empty)

Linux Script Listings

The following installed scripts retain their supplied version-9 paths and historical Darwin/AIX/SunOS branches. Their presence does not establish current support for those systems; current package availability is described under Installation on Linux.

DemoPDF.sh

#!/bin/sh

OSNAME=`uname`
AWKCMD=awk
TFORMER_BIN="/usr/local/bin"
TFORMER_TEMPL="/usr/local/share/TFORMer9/Templates"

if [ "$OSNAME" = "Darwin" ]
then
    TFORMER_BIN="/Library/Frameworks/TFORMer.framework/Commands"
    TFORMER_TEMPL="/Library/Frameworks/TFORMer.framework/Resources/Templates"

elif [ "$OSNAME" = "AIX" ]
then
    TFORMER_BIN="/usr/bin"

elif [ "$OSNAME" = "SunOS" ]
then
    AWKCMD=nawk
fi

echo "**************************************************************************"
echo "Printing templates: $TFORMER_TEMPL"
echo "**************************************************************************"
EXTENSION="pdf"
OUTPUTTYPE="PDF"
OUTPUTDIR="."

find "$TFORMER_TEMPL" -name "*.tff" -print | sort | while read Z ; 
do
  FORMNAME=`basename "$Z" | $AWKCMD -F "." '{ for (i = 1; i < NF; i++) { printf $i; if (i < NF-1) { printf "."; } } print "" }'`
  OUTPUTNAME="$OUTPUTDIR/$FORMNAME.$EXTENSION"
  echo "Printing form      : $FORMNAME"
  # pipe all output from tfprint besides error messages to /dev/null
  $TFORMER_BIN/tfprint -F "$Z" -D "$TFORMER_TEMPL/$FORMNAME.xml" -DT XML -OT $OUTPUTTYPE -O "$OUTPUTNAME" > /dev/null
done
echo "Completed successfully."

DemoBarcodeLabels.sh

#!/bin/sh

OSNAME=`uname`
TFORMER_BIN="/usr/local/bin"
TFORMER_TEMPL="/usr/local/share/TFORMer9/Examples/Demo Repository"

if [ "$OSNAME" = "Darwin" ]
then
    TFORMER_BIN="/Library/Frameworks/TFORMer.framework/Commands"
    TFORMER_TEMPL="/Library/Frameworks/TFORMer.framework/Resources/Examples/Demo Repository"

elif [ "$OSNAME" = "AIX" ]
then
    TFORMER_BIN="/usr/bin"
fi

echo '**************************************************************************'
echo 'Sample: Printing Form BarcodeLabels in Repository Demos.tfr as PDF'
echo '**************************************************************************'

$TFORMER_BIN/tfprint -F "$TFORMER_TEMPL/Demos.tfr" TFORMer_Runtime_Examples BarcodeLabels -OT PDF -O ./BarcodeLabels.pdf 

Paths and Error Checks

The Windows files use Tools\CheckPath.cmd to find TFPrint and its runtime, then select %TEMP% or %TMP% for output. They can overwrite an existing Output.pdf or BarcodeLabels.pdf and open the PDF afterwards. Missing-program, layout, temporary-directory and Office messages belong to the supplied batch files; they do not check every TFPrint exit status or prove successful PDF generation. Check the exit status and the resulting file. The Product Label Quick Start already checks both and uses a new output folder for each run.

DemoPDF.sh processes sorted .tff files, reads the corresponding XML and redirects standard output to /dev/null. Its final Completed successfully. message is unconditional. Check the individual TFPrint errors and output files. For exit codes and diagnostics, see Errors and Exit Codes.

TFORMer SDK - Internal Tool

Purpose:

This command file is internally used by the TEC-IT samples to make sure that the command line tool TFPrint is found.

Trying this sample:

  • Not intended for stand-alone execution.

CheckPath.cmd

@echo off
rem ************************************************************
rem   (c) 2006-2026 TEC-IT Datenverarbeitung GmbH
rem   www.tec-it.com
rem   office@tec-it.com
rem ************************************************************
rem   This batch file searches for TFPrint.exe and the required
rem   TFORMer dll. If found the directory is added to the PATH
rem   environment variable. This ensures that we call the
rem   correct version of TFPrint.
rem ************************************************************

set TFMajorVersion=9
set TFPrintFound=0
set AddToPath=0

rem search in current directory
call :CheckPath "%CD%"
if %TFPrintFound%==1 goto :Cleanup

rem search in path
for %%i in (tformer%TFMajorVersion%.dll) do if NOT "%%~dp$PATH:i"=="" call :CheckPath "%%~dp$PATH:i"
if %TFPrintFound%==1 goto :Cleanup

rem search in ProgramFiles directory

rem Detect Program Files directories
if defined ProgramW6432 (
    set "PF64=%ProgramW6432%"
    set "PF32=%ProgramFiles(x86)%"
) else (
    rem 32-bit Windows
    set "PF64=%ProgramFiles%"
    set "PF32="
)

if not "%PF64%"=="" call :CheckAndAddPath "%PF64%\TEC-IT\TFORMer%TFMajorVersion%\Bin"
if %TFPrintFound%==1 goto :Cleanup

rem search in ProgramFiles(x86) directory
if not "%PF32%"=="" call :CheckAndAddPath "%PF32%\TEC-IT\TFORMer%TFMajorVersion%\Bin"
if %TFPrintFound%==1 goto :Cleanup

rem search in ProgramFiles SDK directory
if not "%PF64%"=="" call :CheckAndAddPath "%PF64%\TEC-IT\TFORMer%TFMajorVersion% SDK\Bin"
if %TFPrintFound%==1 goto :Cleanup

rem search in ProgramFiles(x86) SDK directory
if not "%PF32%"=="" call :CheckAndAddPath "%PF32%\TEC-IT\TFORMer%TFMajorVersion% SDK\Bin"
if %TFPrintFound%==1 goto :Cleanup

:Cleanup
if %TFPrintFound%==0 set ERRORLEVEL=1
set TFMajorVersion=
set TFPrintFound=
set AddToPath=
goto :EOF

:CheckPath
set AddToPath=0
goto :FindTFPrint
:CheckAndAddPath
set AddToPath=1
:FindTFPrint
rem verify dll and tfprint is available
if not exist "%~1\tformer%TFMajorVersion%.dll" goto :EOF
if not exist "%~1\tfprint.exe" goto :EOF

set TFPrintFound=1

if %AddToPath%==0 goto :EOF
set PATH=%~1;%PATH%
echo.
echo Directory %1 added to PATH
echo.

goto :EOF

See TFPrint Overview, Apply a License, and the TFPrint Command-Line Reference.

Search documentation

Search in
More scopes
Additional scopes

All contents