Print in DL and not A4 (NSPrinterMBS.pageSizeForPaper?)

Hi,
i need to print not in A4 but in DL (in Mac).
I use also MBS.
But either in Xojo or MBS seems not to be available a way to setup page size in cm/inch, but only in pixel ?
Also NSPrinterMBS.pageSizeForPaper seems only able to print legal or A4 but not DL …
Any hints ?

Will only return correct values if your printer driver exposes DL as a page size.
Look in the printer setup: does DL appear?
Is it actually called DL or something else?

And you can make a PDF file of any size you like, then give it to your users to print how they wish…

Yes but if i select here (see the pic in attach) DL appears but the choice affects also the other 2 printers and i would avoid that …
My issue in the detail is: i can print with OKI printer leaving A4 but after first print when insert the (second, third) sheets in it (i use in OKI only sheets smaller than A4) the OKI load 2 times the sheet and only at third time it prints properly … so i’ve tried to select DL and all works fine … it works at first try not only the first sheet but also the others (second, third, and so on) (hope is clear)

It says Busta DL
Have you tried ‘Busta DL’ instead of ‘DL’?

Yes i’ve tried Busta DL, but (what i’ve written in the previous post is -sorry- not correct, i’ve just make some new test)
My issue is this:
i use in the OKI printer (setup A4) sheets that are 21 cm large x 11 cm height
The first sheet is printed ok, from the second on the printers continue to print ok BUT load the sheet 2 times without print and only at third time it print correctly.
I’ve so tried to use sheets A4 and all works properly … in fact also the second (third and so on) sheets are printed at first time.
What do you think to solve the empty 2 times loading with lower height sheets ?

Busta DL means Envelope DL. This kind of envelope is 110mm x 220mm.

Yes i know that, but what do you think i should do to fix that issue ?

From MBS at Monkeybread Xojo plugin - WindowsDeviceModeMBS (monkeybreadsoftware.net):

WindowsDeviceModeMBS.DMPAPER_ENV_DL = 27

Type Topic Plugin Version
const Printing MBS Win Plugin 10.4

Function: One of the paper format constants.
Notes: DL Envelope, 110- by 220-millimeters

Does that help ?

i think it’s only for windows, not mac, isn’t it ?
i’m on mac …
nothing that can be done using Xojo directly ?

I Googled for “mac envelope dl” and found a few links on the subject. Some links give an example with pages, and in the print dialog we see that Envelope DL is available for size. Can your printer print on DL ? If so, I guess the manual will tell how to do it on a Mac.

I was told that printing is much easier on a Mac than Windows . . . oh boy can’t agree.

@Christian_Schmitz Can you help the OP ? I am not enough knowledgeable in MacOS. Thanks

Choose Envelope DL (Busta DL) in Page Setup. Then print.

You have implemented Page Setup in your app, haven’t you? Using the ShowPageSetupDialog method?

It is easy. I’m struggling to understand what the issue is.

Sorry for my descriptions of the issue that probably are unclear.
My little app prints on some postal that are smaller than A4 (some are 210mm large x 110mm height some are smaller).
On all these postals the prints are OK my only concern is that after the first print from second on my OKI 24pin load the postals without print (load and reject 2 times without print) and i need to insert the postal 3 times and only at third time it prints correctly (load and reject, load and reject, print)
So i’ve tried to insert not the postal but A4 sheet and the OKI prints correctly and not load and reject the paper anymore.
I’ve tried also select Busta DL on printer setup with no success (to be honest using Busta DL not only it continues to load and reject 2 times but also print not in the correct spaces on postal).
Coming back to your question @TimStreater here’s the code:

Var g As Graphics
Var p As New PrinterSetup
Var DPI_X As Integer
Var DPI_Y As Integer

// clone to NSPrintInfo
dim info as new NSPrintInfoMBS(p.SetupString)

dim printers() as string = NSPrinterMBS.printerNames
dim printer as NSPrinterMBS = NSPrinterMBS.printerWithName(“OKI”)

// now set this printer
info.printer = printer

// and clone back
p.SetupString = info.SetupString

g = p.ShowPrinterDialog

DPI_X = p.HorizontalResolution
DPI_Y = p.VerticalResolution

If g <> Nil Then
Var X, Y As Integer
Var Inch As Double = 2.54
g.FontSize = 12
X = (DPI_X * (1.3-0.4) / 2.54)
Y = (DPI_Y * (2.4-0.4)/ 2.54)
g.DrawString(test.value, X, Y)
End If

You may try NSPrintInfoMBS class to modify the current settings and change paper.
e.g. set paperName or paperSize there.