I think the problem was that at 72 dpi, a pen width of 1 is too thick. That’s why he needs to get a higher resolution. I find it mind-boggling that this isn’t working for him.
Not sure what’s his real ps.HorizontalResolution, VerticalResolution and g.PenHeight after OpenPrinterDialog. Should be better for him thinking in points (device independent resolution) and not pixels to avoid using different printers and obtaining different results. One point is 1/72 inches. If you resolution is 72dpi, 1 point large is 1 pixel large. If 300dpi, 1 point is 4 pixels (pixels=dpi/72*points).
I am a newbie to Xojo so my post comes from this point of view rather than a longtime user.
Clearly it does work. If you draw a line with your code snippet above as well as text the line is clearly thinner but I think you end up using two sets of coordinate systems because unless you apply a scale factor the text is also reduced in size.
This is a limitation of Xojo. It would be far better to have a Graphics that could apply floats with line thicknesses less than 1 as per Cocoa (can’t comment on windows). This limitation I would suspect but can’t be sure goes back to Xojo’s earlier roots and has not kept up with the times.
Until Xojo themselves address this issue this convoluted way of drawing with thick lines will be the norm and you will continue having to address these types of issues.
With regard to text, on a Mac I see no difference in quality in printing at 72 dpi vs 600 with a scale factor probably because the underlying engine uses PDF.
It is a shame that Xojo can’t embrace something like NSBezierPath(Mac) and perhaps the Windows equivalent in order to overcome these difficulties.
All the best
Terry
to answer the question first:
The MsgBox says 72
As Harry said: "With regard to text, on a Mac I see no difference in quality in printing at 72 dpi vs 600 " - this applys also to windows.
And I use now the text to draw Lines in my forms as I statet already.
I have given up.
If in my case the printer doesn’t talk to the programm, it might also happen with other people. And as I plan to give the programm to others, it is better for me not to involve code, which might react different on different platforms. Back to the roots. As simple as possible!
If I do this with g.drawLine(300,400,500,400) inserted my setup returns 600 in the msgbox and the text and line are very small in osx preview. This is to be expected.
If I comment out
’ ps.MaxHorizontalResolution = -1
’ ps.MaxVerticalResolution = -1
I get 72 in the msgbox, the text is normal and the line is normal (1 pixel wide)
If I now put
ps.MaxHorizontalResolution = -1
ps.MaxVerticalResolution = -1
into the code and…
if I divide 600/72 I get a scale factor of 8.3333 recurring
If I apply the scale factor to the text size 48 x 8.3333 and then execute the code I get normal sized text and a small thin line.
This is what I mean by having to apply different coordinates to the line and to the text.
If you require the length of the line to match the length of the text you need to do some calculations using the scale factor.
All the best
Terry
[code]dim ps as new printersetup
dim g as graphics
if ps.PageSetupDialog then
ps.MaxHorizontalResolution = -1
ps.MaxVerticalResolution = -1
g = OpenPrinterDialog(ps)
if g <> nil then
msgbox "Resolution: " + str(ps.HorizontalResolution)
g.TextSize = 48
g.drawstring(“Hello World”, 300, 300)
g.drawLine(300,400,500,400) ' this has been added
end
end[/code]
So now for everybody, who followed this conversation:
I work on two differnt computers. One is very new and runs Windows 8.1 and one runs Windows 7.
As the older one is slower and is making some other troubles, I am running Xojo mainly on the new one. The new one is connected to the printer via WLAN. The older with a cable to the Home-network. Printer also with cable.
Today I tried this problem on the old one. And it runs perfectly.
So either the WLAn is turning off the conversation or the Windows 8.1.
My solution: I stick to 72 - resolution, you never know, how the circumstances are, where the programm will be run by somebody who is even less trained, than I am. (is difficult, but possible)
So good night from Vienna
If you apply a scale factor to everything you print (you may choose to not apply it to things such as lines, or use half the scale factor, etc.), then you get the best possible print regardless of what resolution the printer supports. That’s especially important if you’re printing images of any kind.
FWIW, my daughter’s laptop runs 8.1 and connects to the printer via web services (I don’t know if that’s what you mean by WLAN?). We’ve had nothing but trouble with it. I’m going to download another set of drivers and try to make a different connection to it. If I get a chance, I’ll try to print from Xojo and see if it has the same problem you’re seeing.
I downloaded and installed the actual drivers for the printer and it is giving me 600 for the resolution, which is the max that this printer supports. (And my daughter thanks you for prompting me to finish that “todo” item.)
[quote=94308:@Tim Hare]If you apply a scale factor to everything you print (you may choose to not apply it to things such as lines, or use half the scale factor, etc.), then you get the best possible print regardless of what resolution the printer supports. That’s especially important if you’re printing images of any kind.
[/quote]
If I am using a Graphics on Mac OS X 10.9.3 and use the Draw… and Fill… and Text commands the documentation says that by default it uses “The Quartz graphics engine uses anti-aliasing to make lines look smoother…”.
Does this mean that when Xojo generates it’s output for printing it uses PDF as per the underlying Cocoa system?
If that is the case then surely there is no benefit for Mac users (not sure about windows) to deviate from a standard print of the Graphics as all smoothing etc will be carried out by the underlying OS X system?
There would be benefit in getting a thinner line but this would be done to overcome a limitation of Xojo being restricted to integer width lines?
All the best
Terry
Your initial post was re: windows 8. But even there, text looks ok at 72. Everything else benefits from higher resolution though. If you never print pictures/logos/icons then it probably doesn’t matter.
After some other troubles, I had to exchange the modem - got a new one from the provider.
After installing, the printer could not be addressed from the WLAN-Laptop.
The man from the hotline, told me, that HP-Printers do have problems, if you do not install the original printer-driver from hp-homepage.
So I downloaded 320 MB and installed it.
The printer worked immidiatly and now I do achieve the resoultion of 600 with the above sent programs.
So this all seems to be a problem of the printer-drivers.
Oh god I hate computers … and love them …