To execute PDFImprint programmatically:
Add PDFImprintAPI reference to your project. The reference is listed in .NET tab objects list.
Add using (or import in VB) to your source code
using Inlite;
using System.Collections.Generic;
Instantiate PDFImprintAPI object.
Invoke Execute method with proper parameters.
Handle errors through try-catch
To execute using data source and variables
try
{
PDFImprintAPI obj = new PDFImprintAPI();
List<string> Vars = new List<string>();
Vars.Add("CustomerID=123456");
Vars.Add("FormID=3494");
Vars.Add("RevID=2008");
obj.Execute(@"C:\test1.txt", "inc:seq:1000:2:10",
Vars);
foreach (string s in obj.OutputFiles)
{ // do something with output files
}
}
catch (Exception ex) // Error was detected
{ MessageBox.Show(ex.Message);}
To execute without data source or variables
try
{
PDFImprintAPI obj = new PDFImprintAPI();
obj.Execute(@"C:\test2.txt", "", null);
foreach (string s in obj.OutputFiles)
{ // do something with output files
}
}
catch (Exception ex) // Error was detected
{ MessageBox.Show(ex.Message);}