@jgabriell89 wrote:
Hi,
I'm little bit new to PDF Creator COM and i still trying from your example in vb6, but i'm always getting error '-2147024809 : Empty path is not legal' when i tried to loop the TestPage2PDF process. And i don't know what is wrong with it?
Any help would be great for me.
Private Sub testPage_btn_Click(Index As Integer)
Dim PDFCreatorQueue As Queue
Dim PrintJob As PrintJob
Dim ShellObj As Object
Dim fullPath As String
Dim njajal As String
Dim oPdfCreatorObj As New PdfCreatorObj
Dim i As IntegerSet PDFCreatorQueue = CreateObject("PDFCreator.JobQueue")
assemblyDir = App.Path
fullPath = "\magi-ds\edp-04\Joshua\COBA\trial.pdf"
Set ShellObj = CreateObject("Shell.Application")On Error GoTo ErrorHandler
'this is where i'm try to loop
For i = 1 To 21
njajal = "\magi-ds\edp-04\TRIAL\boba" & i & ".pdf"
MsgBox ("Initializing PDFCreator queue...")
PDFCreatorQueue.InitializeoPdfCreatorObj.AddFileToQueue njajal
'Of course, you can print whatever you'd like to (make use of the PDFCreatorObj obj)
'But in order to keep the code small and clear we will only print the windows test page
'MsgBox ("Printing windows test page...")
'ShellObj.ShellExecute "RUNDLL32.exe", "PRINTUI.DLL,PrintUIEntry /k /n ""PDFCreator""", "", "open", 1If Not PDFCreatorQueue.WaitForJob(10) Then
MsgBox ("The job didn't arrive at the queue within 10 seconds")
Else
MsgBox ("Currently there are " & PDFCreatorQueue.Count & " job(s) in the queue")
MsgBox ("Getting job instance ")
Set PrintJob = PDFCreatorQueue.NextJobPrintJob.SetProfileByGuid ("DefaultGuid") PrintJob.SetProfileSetting "PdfSettings.Security.Enabled", "true" PrintJob.SetProfileSetting "PdfSettings.Security.EncryptionLevel", "Aes128Bit" PrintJob.SetProfileSetting "PdfSettings.Security.OwnerPassword", "1234" PrintJob.SetProfileSetting "PdfSettings.Security.RequireUserPassword", "true" PrintJob.SetProfileSetting "PdfSettings.Security.UserPassword", "4321" MsgBox ("Converting under DefaultGuid") PrintJob.ConvertTo (fullPath) If (Not PrintJob.IsFinished Or Not PrintJob.IsSuccessful) Then MsgBox ("Could not convert the file: " & fullPath) Else MsgBox ("Job finished successfully.") End If
End If
PDFCreatorQueue.Clear
MsgBox ("Releasing the queue object.")
PDFCreatorQueue.ReleaseCom
Next
Exit SubErrorHandler:
MsgBox ("An error occured during the process: " & Err.Number & " - " & Err.Description & ". Releasing the queue object.")
PDFCreatorQueue.ReleaseCom
End SubThank you before.
Posts: 1
Participants: 1