Cannot get the c# examples to work v2.3 or v2,4

hi
I tried testing the example in v2.3 c# example.
I openened the project in vs2012 and added a reference to pdfcreator.exe
the reference in the file was
‘using PDFCreator’
this has to be edited to
‘Using PDFForge.PDFCreator’

then it compiled.
the example worked up to the point where it gets the job from the queue
then throws exception stating no valid version of ghostscript was found
but ghost script is in the relevant folder under pdf creator

so

I upgraded to 2.4 and
opened the example c# project in vs2012
I added the reference to PDFCreator.exe as before
C:\Program Files\PDFCreator\PDFCreator.exe

but this time it will not even build.
it is stating that the namespace PDFCreator.COM does not exist…
can someone please help me on this
I do know how to program c# but this is confusing me

Hi,
I can at least answer the last part:
The COM interface has been moved to the file PDFCreator.COM.dll. If you are referencing the PDFCreator.exe, you now have to reference the PDFCreator.COM.dll. The interface itself did not change. The solution to the Ghostscript issue can sometimes be to install the x86 version of Ghostscript again to PDFCreator path, replacing the GS that came with PDFCreator.

Best regards,

Robin

Hi,
I have a similar problem with v2.4.

When I was trying early binding I was using references to pdfcreator.exe and to pdfcreator.com.dll as well as
“using pdfforge.PDFCreator.UI.COM”.
When executed I’m getting the following error at code line “printJob.ConvertTo(convertedFilePath);”:
“System.Runtime.InteropServices.COMException” in PDFCreator.ComImplementation.dll
“Object reference not set to an instance of an object”.

I can only get the example code to work with late binding and a reference to pdfcreator.exe.
Could you Robin or someone else please post a working example with late binding including the needed references?
Thanks in advance.

It is still the same in version 2.5.1 and 2.5.2.
Have you found a solution or workaround?

Best regards,
Michael

Remove references to PdfCreator.Exe and PdfCreator.COM.DLL in your Vb.Net or C# Project.

You have to modify the PdfForge sample code as shown below :

Private Sub testPage_btn_Click(sender As Object, e As EventArgs) Handles testPage_btn.Click

    **Dim oPrintJob As System.Type = System.Type.GetTypeFromProgID("PDFCreator.PrintJob")**
    Dim oPrintJobCom As Object

    Dim assemblyDir, fullPath As String

    **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)**

    Try
        assemblyDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
        assemblyDir = assemblyDir.Replace("\bin\Debug", "\Results")
        fullPath = Path.Combine(assemblyDir, "TestPage_2Pdf.pdf")

        oJobQueueCom.Initialize()

… etc. etc. etc.

Best regards,

Nobody.

1 Like

About GhostScript : ( C:\Program Files (x86)\gs\gs9.10\bin )

Please respect the relation PdfCreator Version and Ghostscript Version.

From PdfCreator 2.4.0 use Ghostscript 9.19
From PdfCreator 2.2.0 use Ghostscript 9.10
From PdfCreator 2.1.2 use Ghostscript 9.16
From PdfCreator 2.0.1 use Ghostscript 9.14
From PdfCreator 1.9.5 use Ghostscript 9.14

The best stable Ghostscript version are 9.10 and 9.19

Then I recommend to use PdfCreator 2.2.2 or PdfCreator 2.5.2

Sometime PdfCreator not recognizes Ghostscript software.
You have to install and remove the corresponding version of Ghostcript setup for resolve windows registry problems. If the problem persist don’t remove the Ghostscript installation and for the Ghostscript 9.10 version copy the Ghostscript DLL provided by PdfCreator from path > C:\Program Files\PDFCreator\Ghostscript\Bin over the DLL in the path > C:\Program Files (x86)\gs\gs9.10\bin

It seems that all the version used from PdfCreator are Win32.

Best regards,
Nobody.

1 Like

Vous devez vous rappeler que « LateBinding » exige: « Imports System.Reflection » et aucune référence aux deux DLL.

Au revoir,

Nobody.

Hi Robin, is there any C# example that really work with the COM interface?