When I use API, I can do this:
It will print on the printer with a document name, but when I don't use API, how can I set the document name ?VB Code:
Private Type DOCINFO cbSize As Long lpszDocName As String lpszOutput As String lpszDatatype As String fwType As Long End Type Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function StartDoc Lib "gdi32" Alias "StartDocA" (ByVal hdc As Long, lpdi As DOCINFO) As Long Private Declare Function EndDoc Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function StartPage Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function EndPage Lib "gdi32" (ByVal hdc As Long) As Long Private Function PrintTest(ByVal hPrintDc As Long) Dim Result As Long Dim di As DOCINFO 'Structure for Print Document info di.cbSize = 20 ' Size of DOCINFO structure di.lpszDocName = "Document Name: 1234567..." Result = StartDoc(hPrintDc, di) ' Start a new print document '...... the rest of the code... End Function
For example:
The printer does not have a DocumentName property, so I cannot do that, but how else ?VB Code:
Private Function PrintTest() [COLOR=Red][B]Printer.DocumentName = "Document Name: 1234567..."[/B][/COLOR] Printer.Print "testing..." Printer.EndDoc End Function
Can I mix the 2, and set the document name using api, but print on the printer object ?




Reply With Quote