Board index » delphi » How to 'Print preview'

How to 'Print preview'

I am working on a project where it is required to have a print preview
prior to actually printing a (series of) page(s).
I could not locate a reference to this feature (standard in nearly all
Windows applications) in the documentation.

So: how can I preview the printer output.

Replies to email (Ruud.van.der....@ect.nl) are very welcome!

 

Re:How to 'Print preview'


Ruud van der Ham (Ruud.van.der....@ect.nl) wrote:

: So: how can I preview the printer output.

  Does your program lend itself to using QuickReports?  I use it for
most of my applications, and it can do a nice print preview.

Re:How to 'Print preview'


How are you performing the printing?  Quick Reports, Reportsmith,
hardcoding?  To answer your question that needs to be known.

Ruud van der Ham wrote in message <35b44459.112869...@news.leiden.nl.net>...

Quote
>I am working on a project where it is required to have a print preview
>prior to actually printing a (series of) page(s).
>I could not locate a reference to this feature (standard in nearly all
>Windows applications) in the documentation.

>So: how can I preview the printer output.

>Replies to email (Ruud.van.der....@ect.nl) are very welcome!

Re:How to 'Print preview'


In article <35b44459.112869...@news.leiden.nl.net>, Ruud van der Ham
<Ruud.van.der....@ect.nl> writes

Quote
>I am working on a project where it is required to have a print preview
>prior to actually printing a (series of) page(s).
>I could not locate a reference to this feature (standard in nearly all
>Windows applications) in the documentation.

>So: how can I preview the printer output.

>Replies to email (Ruud.van.der....@ect.nl) are very welcome!

As I'm sure you are probably aware no print preview control exists
within Windows itself, although as you state almost everything has them.
I have seen several excellent examples of print preview
forms/applications etc. on the Delphi Super Page (http://sunsite.icm.edu
.pl/delphi/) and Torry's (http://www.torry.ru/).

Assuming the print preview is not editable then I think that the basic
way to do this is to "paint" the information you wish to output onto
either a TBitmap or TMetaFile Canvas. So what you'll need to do is
either calculate how many pages your data will take up and then create X
bitmaps or meta files and then paint on these in one go. Then you can
quickly display them within a TPaintBox or whatever using Draw or
StretchDraw. The alternative to this is to create a single bitmap or
meta file on a page and then paint the required page as the user selects
it. Both have good and bad points. But the basic logic is the same.

I hope this helps
Mark

Re:How to 'Print preview'


I don't know whether this'll work, but if it does, let us know!

You can custom print by drawing on the TPrinter's Canvas property.  SO, try
copying TPrinter.Canvas to some other canvas after printing, before starting
the print job, and then displaying it.

Hope it works!

Digit

Other Threads