Platforms to show: All Mac Windows Linux Cross-Platform

Back to WindowsDeviceModeMBS class.

WindowsDeviceModeMBS.FromRawData(data as memoryblock, Unicode as boolean = true) as WindowsDeviceModeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Printing MBS Win Plugin 13.1 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Creates a new WindowsDeviceModeMBS object with given data.

The data is expected to the in format of DEVMODEW structure with some extra data and the right values inside.
If Unicode is true, we use DEVMODEW and if Unicode is false, we use DEVMODEA structure.

See also:

WindowsDeviceModeMBS.FromRawData(data as string, Unicode as boolean = true) as WindowsDeviceModeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Printing MBS Win Plugin 13.1 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Creates a new WindowsDeviceModeMBS object with given data.

The data is expected to the in format of DEVMODEW structure with some extra data and the right values inside.
If Unicode is true, we use DEVMODEW and if Unicode is false, we use DEVMODEA structure.

See also:

WindowsDeviceModeMBS.FromSetupString(SetupString as String) as WindowsDeviceModeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Printing MBS Win Plugin 14.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Initialized DevMode object from setup string.
Example
dim p as new PrinterSetup

// setup something
call p.PageSetupDialog

// now we have nice setupstring
dim ss as string = p.SetupString

// parse it in device mode
dim d as WindowsDeviceModeMBS = WindowsDeviceModeMBS.FromSetupString(ss)

// duplex is?
MsgBox "Duplex: "+str(d.Duplex)

// change printer
d.DeviceName = "Deskjet 2540 series#:2"

// enable duplex
d.Fields = BitwiseOr(d.Fields, d.DM_DUPLEX)
d.Duplex = d.DMDUP_HORIZONTAL

// now duplex is?
MsgBox "Duplex: "+str(d.Duplex)

// get back as setup string
dim da as string = d.SetupString

if da = "" then
MsgBox "failed to create setup string"
Return
end if

// assign back
p.SetupString = da

// take a look
call p.PageSetupDialog

// and print something
dim g as Graphics = OpenPrinter(p)

g.DrawString "Page 1", 20, 20
g.NextPage
g.DrawString "Page 2", 20, 20

You can pass string from PrinterSetup.SetupString.

Supports Xojo 2017r1 with 17.3 plugins.

Some examples using this method:

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


The biggest plugin in space...