COM API Error in version 2.5.2.5233

Hi!
I'm trying to use COM API to print file to PDF. I tried c# sample that is going with PDFCreator installation (PDFCreator\COM Scripts\C#.Net\COM_TestForm) but I'm getting the following error:

Could you help me please ? Thank you in advance :slight_smile:

System.ArgumentException: 'The interaction pdfforge.PDFCreator.UI.Interactions.MainWindowInteraction was not registered with a view!'

Obsidian.dll!pdfforge.Obsidian.Interaction.WindowRegistry.ResolveWindowForInteraction(System.Type interactionType) Unknown
Obsidian.dll!pdfforge.Obsidian.InteractionInvoker.Invoke<pdfforge.PDFCreator.UI.Interactions.MainWindowInteraction>(pdfforge.PDFCreator.UI.Interactions.MainWindowInteraction interaction) Unknown
PDFCreator.ViewModels.dll!pdfforge.PDFCreator.UI.ViewModels.MainWindowThreadLauncher.MainWindowLaunchThreadMethod() Unknown
PDFCreator.Utilities.dll!pdfforge.PDFCreator.Utilities.Threading.SynchronizedThread.RunThread() Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() Unknown

The C# code is this (it fails at "if (!jobQueue.WaitForJob(10))")

//dynamic jobQueue = Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("66A9CAB1-404A-4918-8DE2-29C26B9B271E")));
Queue jobQueue = new Queue();

        var assemblyDir = Assembly.GetExecutingAssembly().Location;
        var resultsDir = assemblyDir.Replace("\\bin\\Debug\\COM_TestForm.exe", "\\Results");
        var convertedFilePath = Path.Combine(resultsDir, "TestPage_2PDF.pdf");

        try
        {
            jobQueue.Initialize();
            PrintWindowsTestPage();
            
            if (!jobQueue.WaitForJob(10))
            {
                MessageBox.Show("The job didn't arrive within 10 seconds");
            }
            else
            {
                var printJob = jobQueue.NextJob;
                printJob.SetProfileByGuid("DefaultGuid");                    
                printJob.ConvertTo(convertedFilePath);

                if (!printJob.IsFinished || !printJob.IsSuccessful)
                {
                    MessageBox.Show("Could not convert: ");
                }
                else
                {
                    MessageBox.Show("The conversion was succesful!");
                }
            }
        }
        catch (Exception err)
        {
            MessageBox.Show("An error occured: " + err.Message);
        }
        finally
        {
            jobQueue.ReleaseCom();
        }

Hi,

I am afraid the current version has some bugs in the COM interface.
Please remove the reference to the PDFCreator.exe.
Afterwards you will probably get a different error, complaining about not finding the PDFCreator.exe and/or some of the required DLLs. Running the script from the PDFCreator main folder or copying all required files to the scripts path should solve this problem.
If you don’t need any of the new features, it might be easier to use PDFCreator 2.4 instead.
Sorry for the trouble, we will try to completly fix this with the next update.

Best regards,

Robin

Hi Robin,
thanks for the info - I have tried 2.4.1 and it seems to be working fine.
I’m looking forward for the next update then.

Best wishes :slight_smile:

I had the same problem and the Version 2.4.1 is working for me too. Could you say, when the next update with bugfree COM interface will be arrive? I asked because of important bug fixes from version 2.5.2 that I waiting for.

Hi,

we are currently testing the 2.5.3 bugfix update which will fix the COM problems. If we don’t find a large amount of unexpected problems while testing, the update will be released on monday.

Best regards,

Robin

1 Like

Thank you very much! I’m really looking forward to monday! :slightly_smiling_face: