Hi @ll,
I am trying to convert different Document types like pdf, doc, xls etc. to Tiff using an VB6 Application. My Problem is that in the VB Code the eReady Event is not called and I don't know why.
Is there an issue with PDF Creator 0.9.2?
I have tested my code extensively in different varieties but it did not work. Could you see any Problem?
Thanks a lot!!!
Private opt As clsPDFCreatorOptions
Public WithEvents PDFCreator As PDFCreator.clsPDFCreator
Private isprinterready As Boolean
Private Sub cmdConvert_Click()
Call prt
End Sub
Public Sub PDFCreator_eReady()
isprinterready = True
Debug.Print """" & PDFCreator.cOutputFilename & """ was created! (" & _
DateDiff("s", StartTime, Now) & " seconds)"
Screen.MousePointer = vbNormal
End Sub
Public Sub PDFCreator_eError()
Set pErr = PDFCreator.cError
Debug.Print "Error[" & pErr.Number & "]: " & pErr.Description
Screen.MousePointer = vbNormal
End Sub
Private Sub prt()
isprinterready = False
For i = 1 To 10
PDFCreator.cOption("AutosaveFilename") = "RepName" & i & " .tif"
isprinterready = False
PDFCreator.cPrintFile ("d:\Fortschrittsbalken bei Suche.doc")
PDFCreator.cPrinterStop = True
DoEvents
While isprinterready = False
Debug.Print "not ready"
DoEvents
Wend
DoEvents
'PDFCreator.cPrinterStop = False
Next i
Debug.Print Err.Description
End Sub
Private Sub Form_Load()
Set PDFCreator = New PDFCreator.clsPDFCreator
With PDFCreator
.cStart "/NoProcessingAtStartup"
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = "C:\tmp\tiff"
.cOption("AutosaveFormat") = 5 ' 0 = PDF
.cOption("BitmapResolution") = 200
.cOption("TiffColorscount") = 5
End With
End Sub
There are some bugs in your code!
1.) Use "Option Explicit"!!!! This is highly recommend!
2.) Here the code:
'Code start
Option Explicit
Public WithEvents PDFCreator As PDFCreator.clsPDFCreator
Private isprinterready As Boolean, StartTime As Date
Private Sub cmdConvert_Click()
cmdConvert.Enabled = False
Screen.MousePointer = vbHourglass
Call prt
Screen.MousePointer = vbNormal
cmdConvert.Enabled = True
End Sub
Public Sub PDFCreator_eReady()
isprinterready = True
Debug.Print """" & PDFCreator.cOutputFilename & """ was created! (" & _
DateDiff("s", StartTime, Now) & " seconds)"
End Sub
Public Sub PDFCreator_eError()
Set pErr = PDFCreator.cError
Debug.Print "Error[" & pErr.Number & "]: " & pErr.Description
Screen.MousePointer = vbNormal
End Sub
Private Sub prt()
Dim i As Long
isprinterready = False
PDFCreator.cPrinterStop = False
For i = 1 To 3
PDFCreator.cOption("AutosaveFilename") = "RepName" & i & " .tif"
isprinterready = False
StartTime = Now
PDFCreator.cPrintFile ("c:\Test.doc")
While isprinterready = False
DoEvents
Wend
DoEvents
Next i
End Sub
Private Sub Form_Load()
Set PDFCreator = New PDFCreator.clsPDFCreator
With PDFCreator
.cStart "/NoProcessingAtStartup"
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = "C:\tmp\tiff"
.cOption("AutosaveFormat") = 5 ' 0 = PDF; 5 = Tiff
.cOption("BitmapResolution") = 200
.cOption("TiffColorscount") = 5
End With
End Sub
' Code end
Best regards,
Frank
Hi Frank,
thank you very much for your quick answer. It works now and it works fast!
I will tell my collegues and will recommend PDFCreator as very cool tool users and developers!
Best regards,
Björn