COM interface and VB6 - problems updating from 1.0.2 to 1.7.2

I am using version 1.0.2 of PDFCreator (since 2010) in my VB6 application and i never experienced serious trouble with my customers. 
In my code i use Crystal Reports and the user can print reports to PDF using PDFCreator COM interface. 
Now i am releasing a major update of my software and i think it is the right time to update PDFCreator to the last version (1.7.2). I have updated my computer (the one where i compile the application) and all is fine: all the functionality is ok in the compiled app.
BUT ...the same executable on a Windows 7 Pro - where the application was working without any problem with 1.0.2 - shows the monitor and waits indefinitely. I have no idea of what is wrong with my code (may be someting has changed between 1.0.2 and 1.7.2?)
It has to be clear that i have not modified the original vb6 code in any way - it is exactly the same it was when i started using PDFCreator!

Here is my code:

Private WithEvents pdfJob   As PDFCreator.clsPDFCreator
Private pdfErr              As clsPDFCreatorError

Private blnEndPrt As Boolean

Private Sub doStartPrintJob()
On Error Resume Next

<font color="#0000A0">Set</font> pdfErr = <font color="#0000A0">New</font> clsPDFCreatorError
<font color="#0000A0">Set</font> pdfJob = <font color="#0000A0">New</font> PDFCreator.clsPDFCreator
<font color="#0000A0">If Err</font>.Number <> 0 <font color="#0000A0">Then</font>
    doShowMsg <font color="#008080">"Unable to instatiate PDFCreator"</font>
    <font color="#0000A0">Exit Sub</font>
<font color="#0000A0">End If</font>

<font color="#0000A0">If</font> pdfJob.cStart<font color="#C00000">(</font><font color="#008080">"/NoProcessingAtStartup"</font><font color="#C00000">)</font> = <font color="#0000A0">False Then</font>
    doShowMsg <font color="#008080">"Unable to start PDFCreator"</font>
    <font color="#0000A0">Exit Sub</font>
<font color="#0000A0">End If</font>

<font color="#0000A0">On Error GoTo</font> PANIC

<font color="#0000A0">With</font> pdfJob
    .cOption<font color="#C00000">(</font><font color="#008080">"UseAutosave"</font><font color="#C00000">)</font> = 1
    .cOption<font color="#C00000">(</font><font color="#008080">"UseAutosaveDirectory"</font><font color="#C00000">)</font> = 1
    .cOption<font color="#C00000">(</font><font color="#008080">"AutosaveDirectory"</font><font color="#C00000">)</font> = <font color="#008080">"C:\\Tmp\"</font>
    .cOption<font color="#C00000">(</font><font color="#008080">"AutosaveFilename"</font><font color="#C00000">)</font> = <font color="#008080">"TestFile"</font>
    .cOption<font color="#C00000">(</font><font color="#008080">"AutosaveFormat"</font><font color="#C00000">)</font> = 0		<font color="#008000">' 0 = PDF</font>
    .cOption<font color="#C00000">(</font><font color="#008080">"AutosaveStartStandardProgram"</font><font color="#C00000">)</font> = 0
<font color="#0000A0">End With</font>

<font color="#0000A0">Call</font> doPDF

On Error Resume Next

<font color="#008000">' reset PDFCreator</font>
pdfJob.cClose: <font color="#0000A0">Set</font> pdfJob = <font color="#0000A0">Nothing</font>

End Sub

Private Sub doPDF()
Dim err_lev As Integer
Dim s As String, t As String, mstrErrMsg As String

<font color="#0000A0">On Error GoTo</font> PANIC

 <font color="#008000">' Report1 is a Crystal Report object</font>
Report1.Destination = 1
Report1.DiscardSavedData = <font color="#0000A0">True</font>
Report1.ProgressDialog = <font color="#0000A0">False</font>

<font color="#008000">'Print the document to PDF</font>
doGetPDFPrinter s, t
Report1.Printername = <font color="#008080">"PDFCreator"</font>
Report1.PrinterDriver = s
Report1.PrinterPort = t
err_lev = Report1.PrintReport           <font color="#008000">' do report with Crystal Report</font>

<font color="#008000">'Wait until the print job has entered the print queue</font>

’ Do Until pdfJob.cCountOfPrintjobs = 1: DoEvents: Loop
pdfJob.cPrinterStop = False

<font color="#008000">'Wait until PDF creator is finished then release the objects</font>

’ Do Until pdfJob.cCountOfPrintjobs = 0: DoEvents: Loop
Do Until blnEndPrt: DoEvents: Loop

Report1.ReportFileName = <font color="#008080">""</font>

<font color="#0000A0">If</font> err_lev > 0 <font color="#0000A0">Then</font>
    doShowMsg <font color="#0000A0">CStr</font><font color="#C00000">(</font>Report1.LastErrorNumber<font color="#C00000">)</font> &amp; <font color="#008080">" - "</font> &amp; Report1.LastErrorString
<font color="#0000A0">End If</font>

<font color="#0000A0">Exit Sub</font>

doShowMsg CStr(Err.Number) & " - " & Err.Description
End Sub

Private Sub doShowMsg(ByVal strMsg As String)
lblMsg = strMsg: lblMsg.Refresh
End Sub

Private Sub doGetPDFPrinter(ByRef sDrvName As String, ByRef sPort As String)
Dim objPrt As Printer

<font color="#0000A0">For Each</font> objPrt In Printers
    <font color="#0000A0">If</font> objPrt.DeviceName = <font color="#008080">"PDFCreator"</font> <font color="#0000A0">Then</font>
        sDrvName = objPrt.DriverName
        sPort = objPrt.Port
        <font color="#0000A0">Exit For</font>
    <font color="#0000A0">End If</font>
<font color="#0000A0">Next</font>

End Sub

Private Sub pdfJob_eError()
Set pdfErr = pdfJob.cError
blnEndPrt = True
doShowMsg “Err. [” & pdfErr.Number & "]: " & pdfErr.Description
End Sub

Private Sub pdfJob_eReady()
pdfJob.cPrinterStop = True
blnEndPrt = True
End Sub

<pre style="font-family: 'Courier New', Courier, monospace; font-size: 14px; background-color: rgb(255, 255, 255);"><span style="font-family: Arial, Verdana; font-size: 13px; white-space: normal;">Maybe someone knows a trick to escape from this maze?</span>


did you use the automatic update, or did you manually uninstall, reboot and reinstall on your win7 machine?
If you didn’t do it manually, it might help to uninstall, reboot and reinstall.
Also check if the newer version of PDFCreator still has writting access to your c:\Tmp (I don’t really see a reason why it shouldn’t have anymore, but just in case)
Does printing a testpage work on your win7 machine?



Hi Robin - Thank you for the reply

I have manually uninstalled 1.0.2 and then reinstalled 1.7.2 - After the first problems, i made a reboot but with no results; next step was to uninstall 1.7.2 / reboot / reinstall 1.7.2 - but with any success. There is something very strange: PDFCreator starts (i see the monitor running) but it waits for something that never happens (the only way to exit the application is to kill it using Task Manager - and then i have to stop manually the PDFCreator process …)

PDFCreator is working - i can print Word or Excel documents without any problem - so i assume that the printer driver is ok and the glitch is on the COM interface side

I have compiled Sample1 in \PDFCreator\COM\VB6\Sample1 to have an idea (it seems very similar to what i am using - in fact, at the time, i used it as a base to start from …)
Well, as expected, it shows exactly the same behavior

Any idea?

Hi Robin

I have been able to have the pdf output from \PDFCreator\COM\VB6\Sample1 !!
Put the executable in the same directory of my application and it works - Now, can you spot any difference in my code and the one in Sample1?
It looks crazy …

Does it show the print jobs on the monitor, or just an empty monitor?

Hi Robin

The old version of my code was showing an empty monitor. 
But … i have completely rewritten the code and now it is working fine. I don’t use loops to wait end of job and the code is now full event related (pdfJob_eReady - pdfJob_eError) - With this escamotage, i have been able to print and email >500 timecards (quite complex) without any problem. I suppose that the loops (Do Until blnEndPrt: DoEvents: Loop) were hanging the print queue?

Anyway, thank you for your reply and for working on a superb product


thank you for the response, this might be helpfull if another user runs into a similar problem.