Calling PDF Converter from .NET
Estimated Reading Time: 1 MinutesWhile APDFL has a .NET interface, PDF Converter only supports C++. To call PDF Converter with .NET, you need to call the executable using Process.Start().
The following is an example of what this might look like, where "tempPSFile" is the input PS file and "PDFConverterJobOptions" is the .joboptions file:
static String PDFConverterLocation = ".\\PDFConverter\\deliver";
static String PDFConverterExecutable = PDFConverterLocation + \\democonverter.exe;
static String PDFConverterJobOptions = "Standard.joboptions";
String PDFConverterBaseArguments = "-efi +n -v -r0 -P " + ".\\ICCProfiles" + " -B " + ".\\Settings\\" + PDFConverterJobOptions;
String PDFConverterArguments = PDFConverterBaseArguments + " " + "-O " + outputFolder + " " + tempPSFile;
using (Process myProcess = new Process())
{
myProcess.StartInfo.WorkingDirectory = PDFConverterLocation;
myProcess.StartInfo.Arguments = PDFConverterArguments;
myProcess.StartInfo.FileName = PDFConverterExecutable;
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.Start();
myProcess.WaitForExit(); //lets wait here
// Console.WriteLine(myProcess.StandardOutput.ReadToEnd()); //if you want to see the PDF Converter console, uncomment this
if (myProcess.ExitCode == 0)
{
successCount++;
}
}