|
FAQ: TFORMer SDK | | | | | | FAQ about retrieving data fields used in a layout, TFORMer with COM, DLL, JAVA, .NET API, silent setup and more... | | |
TFORMer5 .NET | | Retrieving Data Fields Used in a LayoutData 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)
| |
COM and ODBC | | 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
| |
Distribution | | Silent Setup TFORMerSilent Setup of TFORMer 4.5
First, generate a response file:
TFORMer_Setup_4_5.exe /r /f1"C:\temp\setup.iss"
then execute it with silent:
TFORMer_Setup_4_5.exe /s /f1"C:\temp\setup.iss"
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 | |
TFORMer .NET | | How can I Adjust the Number of Copies for a Record set?
// 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";
| |
Clipping | | TFORMer SDK has a Different Label Size than the DesignerIt's because the DLL reads the Default Settings found in the Advanced Tab, the Designer reads the Printing Preferences found in the General Tab.
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.
| |
File Extension | | TFORMer5 can not use JPEG Images via http-LinkWhen 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 | |
Licensing | | 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! | |
TFORMer .NET | | Generate a Repository and Open TFORMer Designer via APIBelow we show you how to generate a repository programmatically and open TFORMer Designer through TFORMer API.
Note: The xmd file (repository based designer file) is not generated automatically. You have to generate an empty xmd file with designer (store this file somewhere in your .NET project) and then copy it into the right location (Forms/[ProjectName] subdirectory) during form creation.
using TECIT.TFORMer;
using System.IO; // FileInfo class
String repositoryPath = @"C:\temp\test\myRep.tfr";
String projectName = "myProject";
String formName = "myForm";
FileInfo repositoryFile = new FileInfo(repositoryPath);
if (!repositoryFile.Exists)
{
// create new repository (read-only flag = false)
Repository newRepository = new Repository(repositoryPath, true, false);
// add project
Project newProject = newRepository.AddProject(projectName);
// add form
FormLayout newFormLayout = newProject.AddFormLayout(formName);
// set file name
newFormLayout.Filename = newFormLayout.Name + ".xmd";
// close and save changes !!!
newRepository.Close(true);
// TO DO:
// add "Forms" sub directory if not exist
// add "Forms\myProject" sub directory if not exist
// copy empty xmd file to Forms\myProject\ (file name must be like set above)
}
// if repository exists (with project and form !):
// open for editing
Repository repository = new Repository(repositoryPath, false, false);
// get project
Project project = repository.GetProject(projectName);
// get form
FormLayout formlayout = project.GetFormLayout(formName);
// open TFORMer Designer
formlayout.Design(@"C:\Program Files\TEC-IT\TFORMer6\Bin\TFORMer.exe",
true, true, false, null);
//formlayout.Design(null, true, true, false, null);
| |
PDF With Special Characters | | 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“.
If your TFORMer SDK project uses a specific TFORMer.xml configuration file, set the option: <PDF ... embed-subset-fonts="1"
| |
Display and Print a PDF | | Display and print a PDF in the browser (MSIE) without user interactionThis can be achieved with the Acrobat PDF Control (AcroPDF.PDF), which is installed with Acrobat Reader. Insert the following code into your html page and view it with MSIE.
<OBJECT id="AcroPDF1" style="width: 750px; height: 550px"
classid="clsid:CA8A9780-280D-11CF-A24D-444553540000">
</OBJECT>
<script>
// load from url
AcroPDF1.src="http://www.tec-it.com/download/PDF/TFORMer6_Developer_EN.pdf";
// or load from file
// AcroPDF1.LoadFile("c:\\temp\\dok2.pdf");
// print all
// AcroPDF1.printAll();
// or print pages from to
AcroPDF1.printPages (1, 2);
</script>
| |
TFORMer With Python | | 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("TFormer60.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'
| |
TFORMer .NET | | DllNotFoundException (0x800703E6), Could not load DLL "TFormer60x64.dll"Problem: One of the required dependencies is missing or could not be found.
Search Order for Dependencies:
- Local path of assembly
- Path of executable
- Path contained in PATH environment variable
Make sure that the TFORMer DLLs (see section deployment and distribution in the developer manual) are in one of these locations.
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 MSI setup if already installed. Restart IIS to reload the assemblies. Afterwards all DLLs should be found.
- Install as global assembly (GAC): Use our TFORMer SDK MSI 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 or sometimes a system reboot (otherwise still the DLLs are not found).
If you don't use our MSI setup make sure that the Visual Studio Runtime Libraries are installed (the required Runtime Version depends on the TFORMer Release - see developer manual). | |
TFORMer .NET | | Exception: Required permissions cannot be acquiredIf 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 | |
|
|
© TEC-IT Datenverarbeitung GmbH, Austria ++43(0)7252/72720 office@tec-it.com |
|