Platforms to show: All Mac Windows Linux Cross-Platform

Back to WindowsPrinterMBS class.

Previous items

WindowsPrinterMBS.SetJob(JobID as Integer, job as WindowsPrinterJobMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 12.4 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Sets job parameters.
Example
dim w as new WindowsPrinterMBS( WindowsPrinterMBS.GetDefaultPrinter, true)
dim jobs() as WindowsPrinterJobMBS = w.AllJobs
MsgBox str(UBound(jobs)+1)+" jobs"

// pick first
dim j as WindowsPrinterJobMBS = jobs(0)
j.Document = "Hello World"

// write back values
call w.SetJob(j.JobID, j)

// error?
if w.Lasterror<>0 then
MsgBox w.LasterrorMessage
end if

see also
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162978(v=vs.85).aspx

WindowsPrinterMBS.SetPrinterSettings(value as WindowsDeviceModeMBS, Mode as Integer=2) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 12.1 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Sets printer settings.
Example
// switch default printer to A5 landscape paper

dim name as string = WindowsPrinterMBS.GetDefaultPrinter
dim p as WindowsPrinterMBS = WindowsPrinterMBS.OpenPrinter(name, false)
dim d as WindowsDeviceModeMBS = p.GetPrinterSettings(9)

if d = nil then
MsgBox p.LasterrorMessage
else
d.PaperSize = d.DMPAPER_A5
d.Fields = BitwiseOr(d.Fields, d.DM_PAPERSIZE)
d.Orientation = d.DMORIENT_LANDSCAPE
d.Fields = BitwiseOr(d.Fields, d.DM_ORIENTATION)

if p.SetPrinterSettings(d, 9) then
MsgBox "OK"
else
MsgBox "Failed: "+p.LasterrorMessage
end if
end if

Mode can be 2 (general printer information), 8 (global settings) or 9 (user settings).

For more information on the GetPrinter function, check this website:
http://msdn.microsoft.com/en-us/library/dd145082(v=vs.85).aspx

Previous items

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


The biggest plugin in space...