Silent Setup TFORMer

TFORMer V7.5.20+

Use the standard EXE setup program, which is available for public download. You can select the feature you want to install with specific feature options - e.g. if you want to install only the .NET component and tfprint in quiet mode run the setup this way:

TFORMer_SDK.exe /quiet FeatTemplates=0 FeatCmdLine=1 FeatDLL=0 FeatCOM=0 FeatNET=1 FeatJava=0 FeatQuickPrint=0 FeatDocu=0

Optional: add parameter InstallFolder=C:\MyInstallDir to install into a specific directory. You can also suppress installation of the VC++ Runtime with InstallVCRuntime=0

Please run the EXE with option -? to see all available command line options.

TFORMer_SDK.exe -?
The setup program contains both the 32 and 64 Bit components, which are selected automatically depending on the target Windows version. By default the setup downloads the Visual C++ Redistributable from Microsoft and installs it if not present on the target system. Alternatively you can copy the vc_redist.x86.exe and vc_redist.x64.exe (correct version!) into the setup path if there is no download connection.

Silent Setup of TFORMer Runtime V5, TFORMer SDK V6+

You can install the TFORMer COM component as follows:

msiexec /i TFORMer_6_0_0.msi INSTALLDIR=C:\TFORMer ADDLOCAL=FeatRuntime,FeatCOM /qn

If you left out INSTALLDIR, the default directory is used for installation (C:\Program Files...)

The ADDLOCAL parameter specifies the features to be installed (multiple Features allowed, separate them with a colon). Here are some examples:

ADDLOCAL=FeatRuntime,FeatCmdLine
ADDLOCAL=FeatRuntime,FeatDLL
ADDLOCAL=FeatRuntime,FeatNET

Missing Visual Studio (C/C++) Runtime Libraries

TFORMer SDK requires the Common Runtime Libraries from Visual Studio (exact version see below). These runtime files are installed by the TFORMer SDK setup automatically.

These libraries are not part of a Windows standard installation. But it is possible to install these libraries from an extra package available from Microsoft:

For more information regarding redistributing TFORMer, see section Distribution and Deployment in the Developer Manual.

Retrieving Data Fields Used in a Layout (TFORMer. NET API)

Data fields in a repository

Repository repository = new Repository ("C:\\Path\\Labels.tfr", false, false);
Project project = repository.GetProject("BarcodeLabels");
FormLayout formlayout = project.GetFormLayout("Label1");
 
// iterate through all DataFields in the project
for (DataField field = project.FirstDataField; field != null; field = field.Next)
{
// check if the DataField is used in the FormLayout
DataFieldUsage usage = formlayout.GetDataFieldUsage(field.Name);

  if (usage == DataFieldUsage.Normal)
  {
    // DataField used in the FormLayout
  }
}

Data fields in a TFF

// create a Repository-instance using a stand-alone FormLayout
Repository repo = new Repository("C:\\Path\\Label.tff", false, false);

// retrieves the global project
Project project = repo.GlobalProject;

// retrieves the one and only FormLayout (stand-alone form)
FormLayout formlayout = project.FirstFormLayout;

// retrieving the data fields:
// use the same code as with the repository (see above)

How Can I Adjust the Number of Copies for a Record Set?

TFORMer .NET

// record set data source 
DataSourceRecordSet recordSet = new DataSourceRecordSet(); 
Record record = new Record(); 
record.NumberOfCopies = 10; 
recordSet.Records.Add(record);

// CSV, ODBC and other data sources
DataSourceCsv dsCsv = new DataSourceCsv(csvFile, ',', '"'); 
Job printJob = new TECIT.TFORMer.Job(); 
printJob.DataSource = dsCsv; 
printJob.RecordCopyDataField = "Copies"; 

How Can I Import a CSV File via Program Code?

The following sample code shows how to use CSV import with a CSV data source defined in the TFF layout file (using TFORMer Designer). For more flexibility it has been configured with a parameter, which specifies the file path: parFilePath

TFORMer Java API

// create new job
job = new Job();

File file = new File ("c:\\Temp\\MyTemplate.tff");
job.setRepositoryName(file.getAbsolutePath());

// Select the Data Source named 'ImportFromCSV' (defined in the Form Layout)
JobDataDataSource jobData = new JobDataDataSource ("ImportFromCSV");

// Set the Data Source Parameter named 'parFilePath'
jobData.setParameterValues ("parFilePath", "C:\\Temp\\myImportFile.csv");   

// Set the output format:
// e.g. EPrinterType.PDFFile, EPrinterType.ZPLFile, EPrinterType.ImagePng
job.setPrinterType(EPrinterType.PDFFile);

// Output file name
job.setOutputName(System.getProperty("user.dir") + File.separator + "MyLabel.PDF");
System.out.println("Printing to " + job.getOutputName());

// Generate Output
 job.setJobData(jobData);
job.print();
The advantage with using a data source defined in the layout: The data source definition may contain the mapping between import fields and layout fields, in addition you can add calculated fields (on demand). Optional data source parameters give you the flexibility for programming or command line interaction.

How Can I Set the Resolution for a Zebra Printer?

Beside changing the resolution for Zebra (ZPL II) printers directly in the Designer (print dialog), you can adjust it also for the SDK or Quickprint as shown below.

The DPI can be permanently set / changed in the TFORMer.xml configuration file (per user and per system).

Location of TFORMer.xml on Microsoft Windows

  • The default (system-wide) TFORMer.xml resides in the directory
    C:\ProgramData\TEC-IT\TFORMer\8
  • In addition, TFORMer supports user specific files which override the default. TFORMer Designer creates this file automatically in a user specific folder:
    C:\Users\**USERNAME**\AppData\Local\TEC-IT\TFORMer\8

Editing the TFORMer.xml

  • Locate the <ZEBRA> node and edit the resolution attribute, which specifies the DPI of the Zebra printer.
  • After saving the file, restart your SDK application (e.g. Quickprint) to read in the new settings.

For further information, see Appendix C: Configuration File TFORMer.xml in the TFORMer Developer Manual.

SDK Option

  • In case you don't want to change the resolution permanently, you can change it also dynamically by program code (or command line) with the following SDK option: resolution=300

How Can I Change the Barcode Draw Mode to Quality?

In some cases you want to change the bar code draw mode for trouble shooting enlarged bars on thermal transfer printers like Printronix T4M or Zebra.

Beside changing the draw mode in the Designer print dialog (Options button), you can adjust it also for the SDK or Quickprint in the TFORMer.xml configuration file on a per user or system basis.

Location of TFORMer.xml on Microsoft Windows

  • The default (system-wide) TFORMer.xml resides in the directory
    C:\ProgramData\TEC-IT\TFORMer\8
  • In addition, TFORMer Designer maintains a user specific file which overrides the default file. This file is created in the user specific folder:
    C:\Users\**USERNAME**\AppData\Local\TEC-IT\TFORMer\8
  • If you deliver a local configuration file along with your application (EXE), it takes precedence over the standard files in the user or program data directories.

Changing the GDI Draw Mode to 'Quality'

  • Open the TFORMer.xml configuration file(s) as indicated above.
  • Locate the <WINGDI><TBARCODE> node.
  • Change the drawing-mode attribute to “2” <TBARCODE drawing-mode="2" />
  • After saving the file, restart your SDK application (e.g. Quickprint) to read in the new settings.

SDK Option

  • In case you don't want to change the drawing mode permanently, you can change it also dynamically by program code (or command line) with the following SDK option: tbarcode-drawing-mode=quality

How Can I Change the Orientation for ZPL Printers?

The orientation is defined in the page settings in the layout. If your printer does not support the original media settings from the layout, you can override them with SDK options (print options). SDK options can be specified for each job either programmatically or via command line.

Below we discuss the required print options for two cases:

Case A

TFORMer Page Settings

  • Media=A6
  • Orientation=Landscape

Applying Page Settings to Media in the Printer

  • Media (Printer) = A6 Portrait
    - Print with Media=A6 Orientation=Landscape ⇒ output will be rotated to fit
    - Page settings can be applied without modification.
  • Media (Printer) = A6 Landscape
    - Set media size to A6 Landscape ⇒ Custom.148mmx105mm
    - Set orientation to Portrait ⇒ no rotation
    media=Custom.148mmx105mm orientation=portrait

Case B

TFORMer Page Settings

  • Media=A6
  • Orientation=Portrait

Applying Page Settings to Media in the Printer

  • Media (Printer) = A6 Portrait
    - Print with Media=A6 Orientation=Portrait ⇒ no rotation
    - Page settings can be applied without modification.
  • Media (Printer) = A6 Landscape
    - Set media size to A6 Landscape ⇒ Custom.148mmx105mm
    - Set orientation to landscape ⇒ output will be rotated to fit
    media=Custom.148mmx105mm orientation=landscape
Instead of specifying a custom media size for A6 Landscape, you can also add A6LS with the size of A6 Landscape to TFORMer.xml and reference A6LS in the media print option.

TFORMer SDK Has a Different Label Size than the Designer

That's because the DLL reads the Default Settings found in the Advanced tab, the Designer reads the Printing Preferences found in the General tab of the printer properties (driver settings).

Solution: Adjust the General Settings of the printer driver in a way that it has the same values as the Default Settings of TFORMer SDK or vice versa.

Licensing TFORMER SDK in MS-IE Through LPK File

LPK licensing is not supported in TFORMer V4.5, V5.0, V6.0. If required, please contact us!

Printing to UNC Path is Slow

If you see a delay when you print to a printer located on a remote print server (via UNC path, printer is NOT installed locally) the reason can be printer driver caching issues. Also status polling, network speed, etc plays a role here.

To resolve the issues, you should install the printer locally. It may also help to just connect to the printer in question - this also triggers driver download and may improve the responsitivity.

How can I Generate a PDF with Special Characters?

When using TFORMer SDK to create a PDF you may encounter the following exception:

The text contains Unicode characters which cannot be printed with the current settings or font. Information: Error Code: 0x0000697c

In order to add the missing Unicode character(s) to the embedded font(s), go to TFORMer Designer menu Tools > Options > PDF: Embed Font with „True Type-Subgroups“.

Selection of TrueType-Subgroups in Fonts category


If your TFORMer SDK project uses a specific TFORMer.xml configuration file, set the option: <PDF ... embed-subset-fonts="1"

How Can I Interface from SAP to TFORMer?

For interfacing to SAP® you have three options (all need some ABAP coding):

TFORMer TFPrint

TFPrint is a command line utility, which creates a print job based upon TFORMer templates. You call TFPrint from within SAP and pass the template file name, the CSV or XML data file name and the target printer in the command line arguments.

tfprint -F "C:\Templates\LogisticLabel.tff" -D "C:\JobData\20220927_ID1022.csv" -DT TEXT –DO SC; -O MyPrinterName -OT WIN32

In ABAP you can use FM SXPG_COMMAND_EXECUTE and the commands maintained in SM69 transaction to run any external scripts. If you want to have a log for troubleshooting, you could redirect TFPrint stdout/stderr to a status file (time stamped with Job ID). If you want to process status/error messages in SAP you could read back the status file after printing.

If you want to isolate/disconnect the printing process from the App Server, you can run TFPrint on another server (Print Server) via Remote Shell Execute.

We recommend to encapsulate the whole printing into a PowerShell or CMD script, this script then can be called from anywhere. Data may be passed and/or Templates may be updated via shared folder; a scheduled cleanup script can remove old job and status files (after nn days).

  • TFPrint is part of the TFORMer SDK and uses an SDK license.
  • For creating the label/report templates you need a TFORMer Designer license.
  • ABAB Coding efforts are low. Remote shell execution needs a proper security setup.

TFORMer Web Service

On request we offer a WCF based web service which provides the TFORMer API in a SOAP (WSDL) compatible format. You can print to all printers available on the server (or remotely) or just create a PDF which is returned to the caller (byte array).

The label templates are stored in a specific directory on the server (App_Data), only the label data is submitted in the SOAP request. Templates could be updated externally by sharing the templates folder or using a file sync tool, which distributes templates from a central folder or master repository. The SOAP response provides full error information, which can be handled by ABAP or just stored in a log for trouble-shooting.

We deliver the service as source code and as precompiled web deploy package. You can host the service in your own infrastructure (Windows server / IIS).

  • In the standard version there is no login mechanism, but the source code (.NET C#) can be freely extended. For external users you should only allow https and use IP whitelisting (feature in IIS).

For accessing the web service from within SAP ABAP you may want to create a proxy and a service consumer – here is a tutorial/guide:

After installation the WSDL can be retrieved from the following URL

http://yourhostname/yourinstallationpath/TFORMer.asmx?WSDL

We don’t have an ABAP sample for consuming (calling) the web service, but the included Test App (C# .NET source code) shows how to fill the request parameters. It can be also used for testing the web service availability/functionality.

  • The web service is based upon TFORMer SDK and uses an SDK license.
  • For creating the label/report templates you need a TFORMer Designer license.
  • ABAB Coding efforts are a bit higher – you need the integrate the SOAP web service calls (proxy class). Once the web service is setup, the solution should run flawlessly.

TFORMer Server

TFORMer Server provides automatic label printing by monitoring specific (adjustable) directories for new job files. The job files are in a proprietary text format or XML format and contain the template to use, the target printer name and the name value pairs (records) for the data fields. The templates are organized in a repository, which is read either from a local or a shared (external) folder. If monitoring a directory is not suitable, you can also pass jobs via a telnet interface or a periodical ODBC query.

The server maintains “spools”, where you see the job files on a per printer basis. You can reprint selected jobs from a spool or stop and continue a spool. Once the job file is imported, the jobs are maintained in the server and managed by either a browser interface or a dedicated “Spool Admin” App. By default there is no status feedback to SAP, except with the telnet/ODBC interface. Unicode is supported by XML files, all other channels use ANSI ASCII or Latin-1.

Please contact us for the demo version and the installation and user manuals.

  • TFORMer Server uses its own license, which is printer/site based.
  • For creating the label/report templates you need a TFORMer Designer license.
  • As long as it’s just writing the data file, the effort for ABAP programming is manageable. On the other hand, this solution needs more knowledge (security setup, how to handle specific error codes, etc) and more user training.
Note that TFORMer Server uses DCOM and needs proper security settings (the service account must be admin to use all features).

How Can I Print a TFORMer Report with Python?

For printing a TFORMer report with Python you can use the following script as example:

 from ctypes import *

 FormFile     = "c:/pathto/formfile.tff"
 DataFile     = "c:/pathto/importdata.csv"

 TF_dll = oledll.LoadLibrary("TFormer8.dll")

 TF_dll.TFormer_LicenseMe("Your Licensee Name ", 4, 1,"Your Key" )
 htform =  TF_dll.TFormer_Init(0)
 rm = TF_dll.TFormer_SetRepositoryName(htform, FormFile)
 rm = TF_dll.TFormer_ResetData(htform)
 rm = TF_dll.TFormer_SetTxtDataFile(htform, DataFile, c_char(","), c_char(" "))
 rm = TF_dll.TFormer_SetCopies(htform,1)
 rm = TF_dll.TFormer_SetStartPosition(htform, 1, 0)
 rm = TF_dll.TFormer_SetPrinter(htform, "", 0)
 rm = TF_dll.TFormer_PrintForm(htform)

print 'finished'

DllNotFoundException (0x8007007E), Could Not Load DLL "TFormer8x64.dll"

Problem (.NET API): One of the required dependencies is missing or could not be found. TFORMer .NET needs both the assembly DLL and some native compiled DLLs, which are included with the SDK.

Search Order for Dependencies:

  • Local path of assembly
  • Path of executable
  • Path contained in PATH environment variable

Required TFORMer Runtime DLLs

Make sure that the TFORMer DLLs (see section Deployment and Distribution in the developer manual) are in one of the search locations. Below is a short list of the required files:

If you don't use our setup make sure that the Visual Studio Runtime Libraries are installed (for exact version see our FAQ or check out the developer manual).

Using TFORMer .NET in a Web Application (IIS)

There are two possibilities:

  • Install as local assembly (no GAC): Copy all TFORMer files into the bin sub folder of your web application - you need the TFORMer Assembly + dependency DLLs + TFORMer.xml. Make sure that there is no TFORMer Assembly installed in the GAC: Uninstall TFORMer SDK setup if already installed. Restart IIS application pool(s) to reload the assemblies. Afterwards all DLLs should be found.
  • Install as global assembly (GAC): Use our TFORMer SDK setup, which installs TFORMer .NET in the GAC and extends the PATH environment variable so that all dependencies are found. Note that updating the PATH environment variable may require an IIS restart (iisreset on admin console) or a system reboot, otherwise the DLLs are still not found.

Exception: Required Permissions Cannot Be Acquired

If you run your application from a network location (UNC path) you may get the above exception when your application tries to load the native compiled TFORMer DLLs.

This is an issue with the .NET Framework's trust level settings on your local machine. The default trust level for the local machine is "Full Trust", whereas for the network share it is not.

Either install the TFORMer SDK on the local workstation(s) and avoid loading them from a network path - or lower the security settings on your machine(s). You can give a specific network path full trust with the Caspol command (for details see the Caspol documentation from Microsoft). The following command would give the local intranet zone full trust (not recommended):

Caspol –m –cg LocalIntranet_Zone FullTrust

Install AutoDoc As Service

If the setup fails to install TFORMer AutoDoc 8 as system service, you can use the following command line to install it through PowerShell.

  • Install TFORMer SDK 8 as prerequisite.
  • Run the AutoDoc installer: If the service cannot be installed, click Ignore and continue with the setup.
  • Run Windows PowerShell as Administrator (type powershell on the Windows start menu)
  • Copy and paste the following command into the shell command line (replace the -Credential with an account, which has sufficient permissions)
    new-service -Name TECIT.TFORMer.AutoDoc -DisplayName "TFORMer AutoDoc 8" -Description "Automatic document generation service utilizing TFORMer SDK 8" -BinaryPathName '"C:\Program Files (x86)\TEC-IT\AutoDoc 8\AutoDoc.exe" "C:\Program Files (x86)\TEC-IT\AutoDoc 8\config.xml"' -StartupType Manual -Credential "domain\user"
  • Configure the service (startup type, account...) under Windows Services.

Programming TFORMer5 COM (Visual C/C++, ODBC)

TFORMer5 COM with Visual C/C++ 6 MFC

ITFORMer* tf = new ITFORMer ();
tf->CreateDispatch("TFORMer5Lib.TFormer");

IJob job = tf->CreateJob (); 

job.SetRepositoryName ("C:/../Repository/Demos.tfr");
job.SetProjectName("TFORMer_Runtime_Examples");
job.SetFormName("BarcodeLabels");
job.SetPrinterName("pdffile:c:\\testit.pdf");

IDataSourceRecordSet records = job.NewDataSourceRecordSet();
records.AddNewRecord();
records.SetDataField("ArticleName", "Mac Adapter");
records.SetDataField("ArticleNo", "12001234");
records.SetDataField("ArticlePrice", "39,00");

job.PrintForm();

tf->DetachDispatch();

ODBC with TFORMer COM

Dim tf As TFORMer5Lib.TFormer
Dim printjob As TFORMer5Lib.IJob
Dim datasource As TFORMer5Lib.IDataSourceOdbc

Dim dsn
Dim uid
Dim password
Dim sql

dsn = "DSN=TFORMer_Sample"
uid = ""
password = ""
sql = "SELECT * FROM tbl_Example;"

Set tf = CreateObject("TFORMer5Lib.TFormer")
Set printjob = tf.CreateJob

printjob.RepositoryName = "R:\ODBCTest\TFORMer1.tff"
Set datasource = 
printjob.NewDataSourceOdbc(dsn, uid, password, sql)

printjob.PrinterName = "PDF:R:\ODBCTest\out.pdf"
printjob.PrintForm

TFORMer5 Can't Use JPEG Images via HTTP-Link

When TFORMer Layouts use images which are loaded from an external http-source the user must take care that the link is using a correct file extension.

For example:

Wrong URL: BaseUrl + Thumbnail?file=label-me
Correct URL: BaseUrl + Thumbnail?file=label-me.jpg