Platforms to show: All Mac Windows Linux Cross-Platform

WindowsAddPrintJobMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Printing Windows MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
A class to send raw data to a printer.
Example
// Print Postscript directly to Postscript printer
const PrinterName = "Brother DCP-8085DN"

dim w as new WindowsAddPrintJobMBS

if not w.OpenPrinter(PrinterName) then
MsgBox "OpenPrinter failed. Is the printer name correct in the source code?"
Return
end if

const DocName = "My Document"

if not w.StartDocPrinter("My Document", w.kDataFormatRAW) then
MsgBox "StartDocPrinter failed."
Return
end if

MsgBox "Print Job ID: "+str(w.JobID)

call w.StartPagePrinter

dim PostScript as string = "%!PS"+EndOfLine.UNIX+".1 setgray"+EndOfLine.UNIX+"0 0 100 100 rectfill"+EndOfLine.UNIX+"showpage"+EndOfLine.UNIX

dim BytesSent as Integer = w.WritePrinter(PostScript)

MsgBox str(BytesSent)+" bytes of "+str(lenb(PostScript))+" bytes sent."

call w.EndPagePrinter
call w.EndDocPrinter

w = nil // close printer

Perfect for printing postscript data to a postscript printer.
You can use this class in several ways:

1. OpenPrinter, AddJob, WriteJob and ScheduleJob.
2. OpenPrinter, StartDocPrinter, StartPagePrinter, WritePrinter, EndPagePrinter, EndDocPrinter and ClosePrinter.
3. OpenPrinter, StartDocPrinter, WritePrinter, EndDocPrinter and ClosePrinter.

Constants

Constant Value Description
kDataFormatRAW "RAW" One of the data format constants. Use this constant if you send to both local and networked printers that use GDI-based printer drivers.
kDataFormatXPS_PASS "XPS_PASS" One of the data format constants. Use this constant to send printer control data directly to printers that use XPSDrv printer drivers.

This class has no sub classes.

Some examples using this class:

Blog Entries


The items on this page are in the following plugins: MBS Win Plugin.


Window   -   WindowsADSystemInfoMBS


The biggest plugin in space...