Error queue.WaitForJob

Hello:

I have this error: The interaction pdfforge.PDFCreator.UI.Interactions.MainWindowInteraction was not registered with a view!

already delete the version 2.5.3 and download the version 2.4 but still I still leave the error, could you help me? I need something else

This is my code:

        Type queueType = Type.GetTypeFromProgID("PDFCreator.JobQueue");
        dynamic queue = Activator.CreateInstance(queueType);
        //Sets up the path where the converted pdf file should be saved in
        string archimagen = @"C:\Trabajo\pdfcreator.png";
        //var fullPath = @"C:\Trabajo\I41189.pdf";
        //string impresora = "PDFCreator";
        queue.Initialize();
        // add more logic here

        //queue.AddFileToQueue("C:\\Trabajo\\I41189.pdf");
        //PrintWindowsTestPage();

        System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
        info.FileName = "C:\\Program Files\\PDFCreator\\PDFCreator.exe";
        info.Verb = "printto";
        info.Arguments = @"/t ""C:\\Trabajo\\Log.txt"" ""PDFCreator""";
        info.CreateNoWindow = true;
        info.RedirectStandardOutput = true;
        info.UseShellExecute = false;
        System.Diagnostics.Process myProcess = System.Diagnostics.Process.Start(info);
        myProcess.WaitForExit();
     
        //string pathToExecutable = "C:\\Program Files\\PDFCreator\\PDFCreator.exe";
        //RunExecutable(pathToExecutable, @"/t ""C:\\Trabajo\\Log.txt"" ""PDFCreator""");                   

        if (!queue.WaitForJob(10))
        {
            MessageBox.Show("The print job did not reach the queue within 10 seconds");
        }

        //oProc.Close();

        var job = queue.NextJob;

        job.SetProfileByGuid("PngGuid");
        job.SetProfileSetting("PngSettings.Color", "Gray8Bit");
        job.SetProfileSetting("PngSettings.Dpi", "300");

        //job.SetProfileByGuid("DefaultGuid"); 
        
        //fullPath was introduced above
        job.ConvertTo(archimagen);

        if (!job.IsFinished || !job.IsSuccessful)
        {
            MessageBox.Show("Error en el proceso");
        }

        job.ReleaseCom();

        MessageBox.Show("Termino PDF Creator");

Thank you so much

Hi,

you can’t run the PDFCreator.exe as process from the COM interface.
Please have a look at the COM script examples which are located in the PDFCreator\COM Scripts folder. The pritning of the .png file to the PDFCreator printer needs to be handled differently, e.g. by printing it from paint to the PDFCretor printer.

Best regards,

Robin

Hi, Robin:

Now check the examples, and run the conversion example to jpg, but it does not work, the test printing converts it to pdf not in jpg. Copy as is the code to my application in csharp.

What can be?

Do I need to add PDFCreator.exe as a service reference?

I’m using version 2.4.1, do I have to update it to the Monday version?

Thanks for your help.

    private void button6_Click(object sender, EventArgs e)
    {
        //Just the 2 lines below are needed for late binding to work
        Type queueType = Type.GetTypeFromProgID("PDFCreator.JobQueue");
        dynamic jobQueue = Activator.CreateInstance(queueType);

        //The rest is still the same as with early binding
        var assemblyDir = Assembly.GetExecutingAssembly().Location;
        var resultsDir = assemblyDir.Replace("\\bin\\Debug\\COM_TestForm.exe", "\\Results");
        var convertedFilePath = @"C:\Trabajo\TestPage_2Jpeg.jpg"; //Path.Combine(resultsDir, "TestPage_2Jpeg.jpg");

        try
        {
            MessageBox.Show("Initializing the job queue");
            jobQueue.Initialize();

            MessageBox.Show("Printing windows test page...");
            PrintWindowsTestPage();

            if (!jobQueue.WaitForJob(10))
            {
                MessageBox.Show("The job didn't arrive within 10 seconds");
            }
            else
            {
                MessageBox.Show("Currently there are " + jobQueue.Count + " job(s) in the queue");
                MessageBox.Show("Getting job instance");
                var printJob = jobQueue.NextJob;

                printJob.SetProfileByGuid("JpegGuid");

                MessageBox.Show("Applying jpeg settings");
                printJob.SetProfileSetting("JpegSettings.Color", "Color24Bit");
                printJob.SetProfileSetting("JpegSettings.Quality", "100");

                MessageBox.Show("Converting under JpegGuid");
                printJob.ConvertTo(convertedFilePath);

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

Hi, Robin:

I am using this command pdf.PrintFileSwitchingPrinters ("C: \ Work \ TestPage.pdf", true);

But I mark this error, you could help me

Hi,

PDFCreator uses .NET to check if the file can be printed or not (it looks for the application which is registered to print the filetype). Unfortunately, the .NET method for this seems to have some problems. Which is your default PDF viewer?

Best regards,

Robin