Clear 'buffer' after printing?

I’m having this trouble after printing the first copy of a document with my Dot Printer.
The first document is printed ok (the paper is loaded and is printed)
If i want to print again (that document or another) my printer takes the paper, loads it, but not print the document.
And again for a second time.
At third time it prints properly.
The issue is myApp related.
Is there a command to ‘clear’ the cache or something else to fix it?
Here’s my code.

g = p.ShowPrinterDialog
If g <> Nil Then

Var X, Y As Integer
Var Inch As Double = 2.54
Var DPI_X As Integer = p.MaxHorizontalResolution // Get te Printer Resolution
Var DPI_Y As Integer = p.MaxHorizontalResolution // Get te Printer Resolution
g.FontName = “Times New Roman”
g.FontSize = 11
X = (DPI_X * (1.5-0.4) / 2.54)
Y = (DPI_Y * (2.1-0.4) / 2.54)
g.DrawString(test.value, X, Y)

End If

I’ve tried to add at the end

but the issue is still here
it seems as the printer detect that are many sheets to print and so after the first print calls for another sheet and again for a second time …
any hint ?
(don’t know if my explanation is clear)

There are too many questions to ask, it would be easier to make a simple demo project showing the problem and post a link to it. We’ll take look.

Hi Julian,
here’s the (very) simple project.

As said this is the scenario:
  1. I insert the sheet in the printer and the first print is correctly printed
  2. if i reprint the second sheet is taken from the printer 2 times (and not prints anything)
  3. only at the 3rd insert the sheet is correctly printed
    i’d like to remove the point 2)

Hmm that is very odd, it works fine here and it is a simple project with nothing strange going on. I see you’re using 2019r3.2, what OS are you using? Does this happen if you print to PDF (if you have that option in your OS)?

Yes, it’s very odd.
I use Mac OS X 10.15.6
My printer is a 24 pin OKI ML5100FBeco.
If i insert sheets with no use of the app the OKI loads correctly the sheets.
In the app i have this strange behaviour.
I’ve tried inserting at the end of the print code
but the result is the same

Oh my… it’s a dot matrix printer? I’m not sure that any of our printing code has been tested on one of those in the last 10-15 years.

I’m here if you want to test it :sunglasses:
I’ve written a little utility that saves me a lot of works in my real life …
If you have instructions i’m willing to help …

According to the OKI website its not supported.

What happens if you do a similar test with something like TextEdit?

It uses a compatible 24 pin Mac OS X Epson driver (and the prints are really cool)
I print everything only from textfield and Labels.
Ehm i’ve never tried to print
g.DrawString(“Hello world!”, X, Y) :lying_face:

I’ll try in an hour a text edit (but if i well remember) works ok

But to answer your question, in terms of printing everything is cleared down as soon as g goes out of scope.

Xojo might be doing something odd that the printer driver is interpreting as a command which puts the printer into an odd mode for a few pages. I don’t know enough about macs to know if you can intercept and read the data going to the printer to see whats its sending.

Failing all this it might be worth a play to try and send some epson fx printer codes directly to the printer:

Someone else might be able to chip in and help you with that if its something you want to try as I don’t know how to raw print on macos (I should really tinker with that some time).