PDFCreator COM Interface fail when is used from a Windows Service


#1

Hi,
jobQueue.WaitForJob(15) return false if the current program that is executing the following portion of code is installed as Windows Service.
The same code, executed as a standard program, works.
Could someone help me?
Thanks!

Type pdfCreatorType = Type.GetTypeFromProgID("PDFCreator.JobQueue");
Trace.Trc("pdf creator type ok");
dynamic jobQueue = Activator.CreateInstance(pdfCreatorType);
Trace.Trc("jobQueue ok");
try
{
jobQueue.Initialize();
Trace.Trc("initialize ok");
if (jobQueue.WaitForJob(15))
{
Trace.Trc("wait ok");
var job = jobQueue.NextJob;
Trace.Trc("JOB ok");
job.SetProfileSetting("OpenViewer", "False");
job.SetProfileSetting("OutputFormat", "Pdf");
job.SetProfileSetting("ShowAllNotifications", "False");
job.SetProfileSetting("ShowOnlyErrorNotifications", "True");
Trace.Trc("Profile setting ok");
job.ConvertTo(Path.Combine(directoryPath, fileName));
Trace.Trc("CONVERT TO ok");
if (job.IsFinished && job.IsSuccessful)
{
jobQueue.ReleaseCom();
return true;
}
else
{
jobQueue.ReleaseCom();
return false;
}
}
else
{
return false;
}


#2

Hi,

PDFCreator can only run in a user session. PDFCreator Server is able to run as service (and does natively). It doesn't support the COM interface but instead has an option to directly use C# for pre/post conversion processing or settings management.

Best regards

Robin


#3

Hi Robin,
thank you very much!
Regards!
Stefano