Problem with Simple Print Job

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
whoit
Posts: 12
Joined: Tue Jul 19 2005

Problem with Simple Print Job

Post by whoit »

I have been experimenting with the printer driver and have found that some code that worked earlier today no longer produces a pdf file.

Can someone please let me know why this might occur?
I see a printjob go to my printer queue with only the Doc Name, Owner and Submitted fields filled in, but no PDF file is produced.
Earlier today it worked.

This is the code:

Code: Select all

Private Sub Command1_Click()
Dim tmpPrinter As Printer
With cdi
    .DriverInit "CoastalPrinter"
    ' First time activation of printer
    .EnablePrinter "Evaluation Version Developer Pro", "07EFCDAB010001001A62D63A7A374ADFC98E5C771E417CBCF622CE145AA431E6CCCF852963C57AE96ECB09167E3050FEC9FA4879FFEB40E4087C394B8B5FB0A19A8C3A1F5877ECDC2876FA965C7E3593F42639234E76372F9D0BCC451E3EC35A34CD77B5A61C16FEE831CFF46D3AEDE4CCCC58AEBAFF2A"
    .CaptureEvents True
    .DefaultDirectory = "C:\temp\sample\pdfs\"
    .PaperSize = 3
    .Orientation = 2
    .Resolution = 300
    .FileNameOptionsEx = &H1 + &H2 + &H20 + &H100000 ' NoPrompt + UseFileName + BroadcastMessages + Hyperlinks
    .DefaultFileName = "test.pdf"
    .SetDefaultConfig
End With

For Each tmprinter In Printers
    If tmprinter.DeviceName = "CoastalPrinter" Then
        Set Printer = tmprinter
        Exit For
    End If
Next tmprinter

Printer.Print
Printer.Print "HELLO WORLD"
Printer.EndDoc
End Sub
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Please call DefaultFileName as follows:

.DefaultFileName = "C:\Temp\test.pdf"

Hope this helps.
whoit
Posts: 12
Joined: Tue Jul 19 2005

Post by whoit »

Thanks - that worked.
Post Reply