Hi, I haven’t found a clear enough answer from previous posts. I’m new to Xojo and could use some guidance on this item: I need to pre-set Page Setup options so the end user never has to input the right settings.
I have a simple desktop app that prints one-off bar code labels to a desktop Dymo LabelWriter printer. Using some of the tutorial code and minor edits of my own, the code below works to print my labels perfectly.
However, each time the user clicks the Print button, they have to change the settings for:
Format For [defaults to Any Printer]
Paper Size [defaults to US Letter]
Orientation [defaults to Portrait]
Anyone working with label printers knows how finnicky they are. I need to change each of these to the precise settings, in which case printing is perfect.
I want to make those setting changes in my app so the end user never has to do this. Can anyone point me to the right example code or provide some tips?
Thanks!
Var g As Graphics
Var p As PrinterSetup
p = New PrinterSetup
If p.ShowPageSetupDialog Then
g = p.ShowPrinterDialog
If g <> Nil Then
Var hDPI As Double = p.HorizontalResolution
Var vDPI As Double = p.VerticalResolution
Var pageWidth As Double = 3.5
Var pageHeight As Double = 1.1
g.FontName = "IDAutomationHC39M Free Version"
g.FontSize = 12
// Width and height of label in inches
Var labelWidth As Double = 3.5
Var labelHeight As Double = 1.1
// Width and height of label in page points
Var labelPageWidth As Double = hDPI * labelWidth
Var labelPageHeight As Double = vDPI * labelHeight
// Print bar code label
g.DrawText(TextArea_BarCode.text,15,50)
End If
End If
6 posts - 4 participants