Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

WindowsDeviceModeMBS.ApplyToSetupString(SetupString as String) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 17.3 No Yes No Yes, Windows only No
Function: Applies current device mode to the given setup string.
Example:
dim p as new PrinterSetup

if p.PageSetupDialog then

dim w as WindowsDeviceModeMBS = WindowsDeviceModeMBS.FromSetupString(s)

w.Copies = 3
w.Fields = BitwiseOr(w.Fields, w.DM_COPIES)

dim s as string = w.SetupString
dim t as string = w.ApplyToSetupString(s)

Break // check

end if
Notes:
The setup string contains a device mode and we replace the one from Xojo with our own.
The other information is kept the same.

Feedback, Comments & Corrections

WindowsDeviceModeMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Creates a new empty device mode.
Notes: Size is set for you to default name of the data structure.

Feedback, Comments & Corrections

WindowsDeviceModeMBS.RawData(Unicode as boolean = true) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 13.1 No Yes No Yes, Windows only No
Function: Copies the raw data of the WindowsDeviceModeMBS class.
Notes:
Returns nil on any error.
If Unicode is true, we use DEVMODEW and if Unicode is false, we use DEVMODEA structure.

Feedback, Comments & Corrections

WindowsDeviceModeMBS.SetupString(ActualHorizontalResolution as integer, ActualVerticalResolution as integer, MaxHorizontalResolution as integer, MaxVerticalResolution as integer, MarginLeft as integer = 2500, MarginRight as integer = 2500, MarginTop as integer = 2500, MarginBottom as integer = 2500, MinMarginLeft as integer = 0, MinMarginRight as integer = 0, MinMarginTop as integer = 0, MinMarginBottom as integer = 0, PageSetupFlags as integer = 8) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 17.2 No Yes No Yes, Windows only No
Function: Creates a setup string from devmode.
Notes:
This setupstring is empty on error.
If not empty, you can assign to PrinterSetup.SetupString.

Please pass reasonable flags.
Check existing SetupStrings from Xojo for possible values.
Resolution parameters can e.g. bei 72.

Supports Xojo 2017r1 with 17.3 plugins.

See also:

Feedback, Comments & Corrections

WindowsDeviceModeMBS.SetupString(Margin as Integer = 2500) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 14.3 No Yes No Yes, Windows only No
Function: Creates a setup string from devmode.
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
Notes:
This setupstring is empty on error.
If not empty, you can assign to PrinterSetup.SetupString.

Supports Xojo 2017r1 with 17.3 plugins.

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins