Quantcast
Channel: PDFCreator - pdfforge forums
Viewing all articles
Browse latest Browse all 2619

PDFCreator COM Interface fail when is used from a Windows Service

$
0
0

@stefanoztc wrote:

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;
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 2619

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>