Printing to a Roll printer

Has anyone any experience of printing on a roll based printer?
Im having real trouble from customers with these things as I want to talk about A1 / A2 etc and they dont get this kind of option.
How do you print to these things?

I’m printing to a small receipt printer with nothing special. This is a Windows only app and uses WindowsPrinterMBS to switch to the receipt printer and back again. API 1.0 example.

Dim ps As New PrinterSetup
//Find the printer.
If Preferences.StringValue(modConstants.kReceiptPrinter) = "" Then
  Dim w As New winPrefs
  w.show
  messagebox "No Receipt Printer Selected", "Select the receipt printer and try again."
  Return
End

//Get the default printer so we can reset it alter
Dim DefaultPrinter As String = WindowsPrinterMBS.GetDefaultPrinter

Dim iRes As Integer = WindowsPrinterMBS.SetDefaultPrinter(Preferences.StringValue(modConstants.kReceiptPrinter))
If iRes <> 0 Then
  MsgBox "Couldn't set the new printer (" + Preferences.StringValue(modConstants.kReceiptPrinter) + ")"
  Return
End


Dim sSetup As String = preferences.StringValue(modConstants.kReceiptPrinterSetup)
If sSetup <> "" Then
  sSetup = DecodeBase64(sSetup)
  ps = New PrinterSetup
  ps.SetupString = sSetup
End

ps.Landscape = False

ps.MaxHorizontalResolution = 96
ps.MaxVerticalResolution = 96

Dim g As graphics 
If ps = Nil Or Keyboard.AsyncOptionKey = True Then
  g = OpenPrinterDialog(ps, Nil)
Else
  g = OpenPrinter(ps)
End
If  g = Nil Then
  Call WindowsPrinterMBS.SetDefaultPrinter(DefaultPrinter) //set the default printer back
  Return
End

preferences.StringValue(modConstants.kReceiptPrinterSetup) = encodebase64(ps.SetupString)

g.TextFont = "Arial"
g.TextSize = 16

Dim iTop As Integer 
Dim iLeft As Integer

iLeft = 20
iTop = 10

g.TextUnit = FontUnits.Pixel

Dim p As picture = app.oLocation.picLogo
If p = Nil Then
  g.DrawPicture picLogo, Max(10, (g.width - picLogo.width)/2), iTop
  iTop = iTop + picLogo.Height + 30
Else
  //238 is the size of our in-house Logo image
  If p.Width <= 238 Then
    g.DrawPicture p, Max(10, (g.width - p.width)/2), iTop
    iTop = iTop + p.Height + 30
  Else
    Dim r As Double = 238/p.width
    Dim pNew As New Picture(p.Width * r, p.Height * r, 32)
    pNew.graphics.DrawPicture p, 0, 0, p.Width * r, p.Height * r, 0, 0, p.Width, p.Height
    g.DrawPicture pNew, 10, iTop
    iTop = iTop + pNew.Height + 30
  End
End



Dim iWidth As Integer

//Draw Address
Dim s As String

s = app.olocation.GetAddressLine

iWidth = g.StringWidth(s)
iLeft = (g.width - iWidth)/2
g.drawstring s, iLeft, iTop

iTop = iTop + 20
s = app.olocation.GetCityStateZip
iWidth = g.StringWidth(s)
iLeft = (g.width - iWidth)/2
g.drawstring s, iLeft, iTop

iTop = iTop + 20
s = app.olocation.GetPhone
iWidth = g.StringWidth(s)
iLeft = (g.width - iWidth)/2
g.drawstring s, iLeft, iTop

//Draw the website
iTop = iTop + 30
g.bold = True
g.textSize = 20
g.Underline = True
s = app.oLocation.GetWebsite
iWidth = g.StringWidth(s)
iLeft = (g.width - iWidth)/2
g.drawstring s, iLeft, iTop

//Draw the line items
iTop = iTop + 30
g.Bold = False
g.Underline = False
g.TextSize = 14


//Do the Header
iLeft = 20
Dim iTextStart As Integer = iLeft
g.TextSize = 14

s = "Dear Valued Customer:"
g.drawstring s, iLeft, iTop
iTop = iTop + 18

s = "Your credit card was declined.  In"
g.drawstring s, iLeft, iTop
iTop = iTop + 18

s = "rare instances a charge may happen"
g.drawstring s, iLeft, iTop
iTop = iTop + 18

s = "anyway.  Please be assured that"
g.drawstring s, iLeft, iTop
iTop = iTop + 18

s = "we will void the transaction automatically."
g.drawstring s, iLeft, iTop
iTop = iTop + 18

s = "This process may take up to five" 
g.drawstring s, iLeft, iTop
iTop = iTop + 18

s = "minutes.  Thank you for your business!"
g.drawstring s, iLeft, iTop
iTop = iTop + 18




//Let's print the Date and time at bottom of receipt
Dim d As New date
g.Bold = False
g.TextSize = 12
iTop = iTop + 20
g.drawstring d.ShortDate + " " + d.ShortTime, iLeft, iTop



iTop = iTop + 20

//Need a receipt that's at least 7 inches. 
Dim iMax As Integer = 7 * ps.MaxVerticalResolution
If iTop < iMax Then
  iTop = iMax
End
g.drawstring "------ ",  iLeft, iTop

//Set the printer back to the default
Call WindowsPrinterMBS.SetDefaultPrinter(DefaultPrinter)
1 Like

Nice to hear that works for you.
I dont get it though.
What size is g? One dimension must be infinite?

Im normally assembling a graphic at the ‘size of the page’ and printing that.
These printers are 24inches wide and ??? long

I’m printing to 3 inch wide receipt paper. The g.width has meaning but g.height doesn’t mean anything. I’ve never tried to find the upper height limit of a page. I do know that for us we had to do a minimum size of the receipt or it wouldn’t dispense properly for us (in a payment kiosk).

What kind of printer are you using? I’ve been trying to print to a Brother QL-800 with lousy results, too. It prints on rolls of peel-off labels.

I typically place everything I want to print on a picture, and then print the picture. Don’t know if it still applies (used to be a limitation), but consider not exceeding 30,000 pixels in any given direction. If exceeding this limit, you have to either tile the print, or adjust the resolution of the image. This technique can also be used for tiling prints, that is, printing over several sheets, a bit like wallpaper. To determine the size, you have to extract the physical size of the printing area, which typically isn’t the same as the media size.
The image shows an image divided into two parts and where the lines indicate the split .

Which is basically my offering.
I think I’m now just up against people who don’t know how to print a PNG file ‘at a size’