WindowsPrinterMBS methods

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

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.


💬 Ask a question or report a problem