Can't print

I have in my application a print function. My problem is that it doesn’ t print from the file menu, but it does when I use the same code for a pushbutton.
This is my code:

Dim stp As StyledTextPrinter
Dim g As Graphics

g = OpenPrinterDialog
If g <> Nil Then
stp =editArea.StyledTextPrinter(g, 727.5)
Do Until stp.EOF
stp.DrawBlock(0, 0, 72
10)
If Not stp.EOF Then
g.NextPage
End If
Loop
End If

how are you calling it from the menu?
are you sure it is reaching this code?

FYI… if you don’t have it this way… I suggest the above code appear ONE place in your app, and called as required.

I added a new menu item with the same code… and now it works.

Has anyone tried this example lately? I just tried this (as well as the StyledTextPrinter example that is included in the Xojo download) with 2017r1.1 on a Windows 10 system, and the resolution of the output looks incredibly low, i.e. unusable. This works well on the Mac.

2016r4 switched Windows drawing & printing to using Direct2d and DirectWrite
There have been issues reported & many have been fixed in 2016r4.1, 2017r1 and 2017r1.1
I’m not sure if the Styledtext issues you’ve noted has been fixed as I cant find a report that mentions “styledtextprinter”

I would encourage you to submit one just to be sure that it doesn’t get overlooked

Done.

<https://xojo.com/issue/47905>

Case #47905 has been closed marked as being a duplicate of <https://xojo.com/issue/45971>. Please sign on to that one.