I'm researching talking directly with a printer using the API. I can not seem to get a print job to print multiple pages. I thought that the EndPagePrinter function call would end one page, and the the StartPagePrinter would start another one, but everything is printing on one page.
Here is a code sample:
Any suggestions would be appreciated.
Thanks, Brinson
Here is a code sample:
Code:
Dim lhPrinter As Long
Dim lReturn As Long
Dim lpcWritten As Long
Dim lDoc As Long
Dim sWrittenData As String
Dim MyDocInfo As DOCINFO
Dim i As Integer
lReturn = OpenPrinter(Printer.DeviceName, lhPrinter, 0)
'lReturn = OpenPrinter("\\oocfiles\hp5p264i", lhPrinter, 0)
'lReturn = OpenPrinter("\\oocfiles\hp4100_226", lhPrinter, 0)
If lReturn = 0 Then
MsgBox "The Printer Name you typed wasn't recognized."
Exit Sub
End If
MyDocInfo.pDocName = "AAAAAA"
MyDocInfo.pOutputFile = vbNullString
MyDocInfo.pDatatype = vbNullString
lDoc = StartDocPrinter(lhPrinter, 1, MyDocInfo)
Call StartPagePrinter(lhPrinter)
For i = 1 To 2
sWrittenData = "Page " & i
lReturn = WritePrinter(lhPrinter, ByVal sWrittenData, _
Len(sWrittenData), lpcWritten)
lReturn = EndPagePrinter(lhPrinter)
Next i
lReturn = EndDocPrinter(lhPrinter)
lReturn = ClosePrinter(lhPrinter)
Any suggestions would be appreciated.
Thanks, Brinson