Having a problem with ConvertTo(path)


#1

I am having a problem with ConvertTo(path).

I keep getting a Object reference not set to an instance of an object.

It finds the job in que and sets the profile, but it wont convert it.

My code

        Dim PDFCreatorQueue As pdfforge.PDFCreator.UI.COM.Queue
        Dim printJob As pdfforge.PDFCreator.UI.COM.PrintJob

        PDFCreatorQueue = New pdfforge.PDFCreator.UI.COM.Queue()

        rs.Print("Starting print que")
        PDFCreatorQueue.Initialize()

        Try
            If Not PDFCreatorQueue.WaitForJob(10) Then
                MsgBox("The print job did not reach the print que within 10 seconds")
                PDFCreatorQueue.ReleaseCom()
            Else
                rs.Print("There are " & PDFCreatorQueue.Count & " jobs in the que")
                printJob = PDFCreatorQueue.NextJob
                printJob.SetProfileByGuid("DefaultGuid")
                printJob.ConvertTo("P:\CAD\RhinoDek\yup.pdf")
                If (Not printJob.IsFinished Or Not printJob.IsSuccessful) Then
                    MsgBox("Could not convert the file:")
                Else
                    MsgBox("Job finished successfully")
                End If
            End If
        Catch ex As Exception
            MessageBox.Show("Original error: " & ex.Message)
        Finally
            PDFCreatorQueue.ReleaseCom()
        End Try

PDFCreators Error Logs
2017-02-15 13:34:11.4689 [Error] pdfforge.PDFCreator.Core.Workflow.ConversionWorkflow.RunWorkflow: System.NullReferenceException: Object reference not set to an instance of an object.
at pdfforge.PDFCreator.Conversion.Ghostscript.Conversion.GhostscriptConverter.GetGhostscript()
at pdfforge.PDFCreator.Conversion.Ghostscript.Conversion.GhostscriptConverter.DoConversion(Job job)
at pdfforge.PDFCreator.Core.Workflow.JobRunner.Convert(Job job)
at pdfforge.PDFCreator.Core.Workflow.JobRunner.RunJob(Job job)
at pdfforge.PDFCreator.Core.Workflow.ConversionWorkflow.DoWorkflowWork()
at pdfforge.PDFCreator.Core.Workflow.ConversionWorkflow.RunWorkflow(Job job) System.NullReferenceException: Object reference not set to an instance of an object.
at pdfforge.PDFCreator.Conversion.Ghostscript.Conversion.GhostscriptConverter.GetGhostscript()
at pdfforge.PDFCreator.Conversion.Ghostscript.Conversion.GhostscriptConverter.DoConversion(Job job)
at pdfforge.PDFCreator.Core.Workflow.JobRunner.Convert(Job job)
at pdfforge.PDFCreator.Core.Workflow.JobRunner.RunJob(Job job)
at pdfforge.PDFCreator.Core.Workflow.ConversionWorkflow.DoWorkflowWork()
at pdfforge.PDFCreator.Core.Workflow.ConversionWorkflow.RunWorkflow(Job job)


#2

Im just going to assume this wont work

Cause there are multiple posts that are reporting this.


#3

Hi,

did you get this error with PDFCreator 2.4.1 or later?
I just tested this with the latest version 2.5.0 and there was no error, but no changes to the COM interface where made between 2.4.1 and 2.5.0 as far as I know. Is P: a network drive, does it work if you change the path to you users documents folder?

Best regards,

Robin


#4

Do you have any updates for this problem? It is still the same in version 2.5.1 and 2.5.2 and it occours also in c# example code.

Best regards,
Michael


#5

If you test the problem whith Java Script Sample or Vb.Net the problem seem not be there.

If you test the problem with C# or Vb.Net the problem appears.
You have to instance the object in the same manner like Js or vb6.

Dim oJobQueue As System.Type = System.Type.GetTypeFromProgID(“PDFCreator.JobQueue”)
Dim oJobQueueCom As Object = System.Activator.CreateInstance(oJobQueue)

Dim oPdfCreatorDef As System.Type = System.Type.GetTypeFromProgID(“PDFCreator.PdfCreatorObj”)
Dim oPdfCreatorObj As Object = System.Activator.CreateInstance(oPdfCreatorDef)

Dim oPrintJob As System.Type = System.Type.GetTypeFromProgID(“PDFCreator.PrintJob”)
Dim oPrintJobCom As Object

Best regards.
Nobody.

P.S.:
If you use this method don’t forghot to remove references to PdfCreator.Exe and PdfCreator.COM in your project Vb.Net or C#