Error 5142 VB6 Converter Demo

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
Bill Reese
Posts: 3
Joined: Sun Jun 29 2003
Location: Columbus, OH
Contact:

Error 5142 VB6 Converter Demo

Post by Bill Reese »

Hello,

I'm receiving error 5142 when attempting to send a word doc to the virtual printer. Followed the instructions in the dev manual and just can't seem to get this hummer to work. I'd very much like to buy the ActiveX control, but must be able to show it works correctly.

Windows 2000 (local development machine, I'm the administrator)
Demo 2.10

Here's my code:

BEGIN-CODE********************************************
Option Explicit

Public cdi As CDIntfEx.CDIntfEx

Private Sub Form_Load()

On Error GoTo printer_error
' install a new printer attach to existing printer

Set cdi = New CDIntfEx.CDIntfEx

cdi.PDFDriverInit "Bills Printer"
' First time activation of printer
cdi.EnablePrinter "Evaluation Developer License", "07EFCDAB010001003022881343F9EB6744EF908EB7A75546887F264955D0A813F95EFA67E58E0105400829B1B20D2AFA80BA86A0B0D61B657484D98BF592DE13F69BF7D9F6908FE3F4EBAB3B0AB2358ACB5ED028E12FC8849576BB4F387A6FD0DDA4943D4D4EFBB687ECA0CD"
' set printer as system default
cdi.SetDefaultPrinter
Exit Sub
printer_error:
MsgBox "Sorry, could not install printer"

End Sub

Private Sub Form_Unload(Cancel As Integer)
' restore default printer before removing our printer
cdi.RestoreDefaultPrinter
' close the printer handle and remove printer
cdi.DriverEnd
Set cdi = Nothing
End Sub

Private Sub BtnPrint_Click()
Dim wdApp As Word.Application
Dim wdDoc As Word.Document

' activate printer before printing
cdi.EnablePrinter "Evaluation Developer License", "07EFCDAB010001003022881343F9EB6744EF908EB7A75546887F264955D0A813F95EFA67E58E0105400829B1B20D2AFA80BA86A0B0D61B657484D98BF592DE13F69BF7D9F6908FE3F4EBAB3B0AB2358ACB5ED028E12FC8849576BB4F387A6FD0DDA4943D4D4EFBB687ECA0CD"
cdi.FileNameOptionsEx = 1 + 2 ' NoPrompt + UseFileName
cdi.DefaultFileName = "C:\Source\VB6\PDF\Amuyuni\test.pdf" ' set output file name

Set wdApp = New Word.Application

Set wdDoc = wdApp.Documents.Add

' Test text

wdApp.Selection.TypeText ("SQL Server: " & vbTab & vbCrLf)
wdApp.Selection.TypeText ("Database Name: " & vbTab & vbCrLf)
wdApp.Selection.TypeText ("Doc Date: " & vbTab & Date & " - " & Time & vbCrLf)

wdApp.ActivePrinter = "Bills Printer"
wdDoc.PrintOut <--- Error 1452 happens here...

wdApp.Visible = True
wdApp.Quit

Set wdDoc = Nothing
Set wdApp = Nothing

End Sub
END-CODE********************************************

By the way, the virtual printer is created and I've viewed printer properties while in dubug mode (before the app shuts down). I even tried to manually enter the activation code thru the properties window and received an invalid activation code error. I copied the activation code when I downloaded the demo.

Thanks in advance for any help,

Bill
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

The activation code you are using seems un-functional. We will check the activation codes posted to our site. Did you download your demo version recently?

Please use the following activation code instead:
07EFCDAB01000100F28DDF7E0909C22D462A5475D796E74B4398ADC875B6812A4C4AA813064F69C896B7C7FF1B4ED67241F6388BB8748B047451B8F912B1ACD98140B9FBA6C445C7DD83E2D51019E1681965D5EF1809B568AF065B4FAF439EB96B35C7810F1E245970A160F9

Concerning the error you are getting, it is a Windows error, it means:
"Insufficient system resources exist to complete the requested service."

Please check that the path of the output pdf file exists effectively on your system, the PDF Converter will not a create a directory if it doesn't exist on your system.

Hope this helps.
Bill Reese
Posts: 3
Joined: Sun Jun 29 2003
Location: Columbus, OH
Contact:

Post by Bill Reese »

Joan,

That did it, thanks!

Bill
Bill Reese
Posts: 3
Joined: Sun Jun 29 2003
Location: Columbus, OH
Contact:

Post by Bill Reese »

Follow-up in case anyone else runs into this situation after buying the ActiveX.

After buying the ActiveX control, I started to receive the 5142 error again. To fix, I changed from:

cdi.EnablePrinter "Evaluation Developer License", "xxxx......"

to

cdi.EnablePrinter "Guardian Auto Glass", "xxxx......"

Guardian Auto Glass is my company name. This fixed the problem.

Bill
Post Reply