Print preview questions

I have a report that I draw on a canvas for print preview at 72dpi

Then when they hit print I iterate over each page that I had drawn to canvas… which are graphics objects…
and they are scaled to the max printer resolution. Resulting printout is fuzzy.
So I think scaling 72dpi up to 720 dpi does not work… and instead have to draw original graphics at th 720 dpi.

Need some pointers here for sure…

  • do you draw print preview and max printer resolution?
  • do you open printer dialog before print preview to get printer resolution?
  • or do you blindly print at 72 dpi, open printer dialog, then redraw all pages at max resolution to printer instead of to print preview form canvas?

I just can’t seem to get this to work right. (no one seems to use Turboreport which I am using… the sample project prints fuzzy bc it never draws it at right resolution or just scales it up and it doesnt work right) So if you have turboreport experience great… but even if you don’t … offer suggestions if you have them.
Spent 3 weeks on this off and on and cant get it to work right.

I store an intermediate representation of the objects. The key is to render the graphics at the last possible moment. So I have a class with properties like Font, Size, Column, LineNumber, Text, Color, Width, Height, and a type code: text, rectangle, filled rect, line, etc. Coordinates and width/height are stored in an internal scale (I arbitrarily chose 100ths of an inch, to make layout easier) and translated to screen/printer coordinates when the graphics are actually rendered - at the moment of printing or display.

You have to draw to the screen at 72dpi and to the printer at whatever resolution it supports. I notice you use TurboReports, (which I missed when writing the above paragraph), so I don’t know if this applies. I suspect you have to run the report twice - once for preview and again for printing.

Yes I am trying to do this, but the TurboREport is a canvas on the print preview… when they click print I try to redraw the report at 300 dpi at least… it is failing with some nil object error on a constant which makes no sense to me.

I looked at the printing example with Xojo but I’m still not getting this to work. Are there any other print preview examples?

I just was looking at word for mac and it does not do a print preview. You can open as a PDF but if you print off of settings it goes to printer directly.

Also what happens if you show preview at 300 dpi… does that matter? Maybe that’s what I can do and just not do 2 passes.

On OS X, you don’t need to worry about DPI, as long as you draw using Xojo graphics functions or CoreGraphics / NSGraphics classes, it will come out at high resolution. You must draw directly to the graphics object, you can’t cache it to a picture and then draw the picture.

On Mac (and on Windows with a PDF Printer), you can save as PDF to disk too.

Yes I am trying to do this, but the TurboREport is a canvas on the print preview… when they click print I try to redraw the report at 300 dpi at least… it is failing with some nil object error on a constant which makes no sense to me.

I looked at the printing example with Xojo but I’m still not getting this to work. Are there any other print preview examples?

I just was looking at word for mac and it does not do a print preview. You can open as a PDF but if you print off of settings it goes to printer directly.

Also what happens if you show preview at 300 dpi… does that matter? Maybe that’s what I can do and just not do 2 passes.

Everything is drawn to TurboReport. I dont know what is using underneath… I can examine it… I do know that it adjusts things based on resolution… font size, image resolution etc.

If I print preview at 300 dpi it would solve all problems but doing that… it takes forever for the print preview to appear…

I wrote an article in the Xdev Magazine about using the OS X Print Preview dialog http://www.xdevmag.com/browse/12.3/12305/

It’s a bit awkward in Xojo as we can’t capture some of the Cocoa events to do it just like a Obj-C application does, but maybe it’ll help?