Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Implement Print Preview?

478 views
Skip to first unread message

BobD

unread,
Mar 10, 2000, 3:00:00 AM3/10/00
to
Folks--

I'm doing some label printing (a lot of textout to the printer canvas) and
I'd like to be able to preview the resulting page or possibly individual
labels. Looked through my Teixeira & Pacheco (among others) but I can't
find a good discussion of how to do it. Teixeira & Pacheco say to use a
TMetaFile but there aren't any implementation details.

Is there a good tutorial or example of this online somewhere?

Thanks,
bobD

Carsten Bonde

unread,
Mar 10, 2000, 3:00:00 AM3/10/00
to
Hi Bob,

if you can use the Delphi-Component Quick-Report then you have a preview
included.
I think a saw some examples on the homepage of http://www.qusoft.com/ (The
authof of Quickreport)

There is another ng which may help you further.
b.p.d.reporting-charting

Maybe it helps you.

Cheers
Carsten.

BobD schrieb:

BobD

unread,
Mar 10, 2000, 3:00:00 AM3/10/00
to

Stuart Clennett

unread,
Mar 10, 2000, 3:00:00 AM3/10/00
to
Hi Bob,

I read that about TMetaFiles too. I had a quick go and almost managed it.
Read up about TMetaFile 'cause it is quite simple. It has a "canvas" and if
you write your label printing routine to write to the canvas of the
tmetafile instead of printer, open a form and "play" the metafile to it. I
seem to remember that I had to mess about with the co-ordinates. I had a
RichEdit and I was attempting to preview the doc, but if I remember
correctly it came out h-u-g-e.

Sorry -- can't find my code...

HTH

Stu.
BobD wrote in message <8aarjq$i0...@bornews.borland.com>...

Daniėl Maartense

unread,
Mar 10, 2000, 3:00:00 AM3/10/00
to
Have a look at http://www.csse.monash.edu.au/~vtran/

Here you will find a component called 'Print Preview'. It comes with
full source.

_/_/_/_/_/ Robert _/_/_/_/_/

Earl F. Glynn

unread,
Mar 10, 2000, 3:00:00 AM3/10/00
to
"BobD" <RBDa...@prodigy.net> wrote in message
news:8aaill$hv...@bornews.borland.com...

> Is there a good tutorial or example of this online somewhere?

There are a few "Print Preview" links at
http://www.efg2.com/Lab/Library/Delphi/Printing

Printer Demo #2 might also be useful since it shows how
to draw shapes and text to both the screen and the printer:
http://www.efg2.com/Lab/OtherProjects/PrinterDemo2.htm

--
efg

Earl F. Glynn E-Mail: Earl...@att.net
Overland Park, KS USA

efg's Computer Lab: http://www.efg2.com/Lab

BobD

unread,
Mar 11, 2000, 3:00:00 AM3/11/00
to
>
> There are a few "Print Preview" links at
> http://www.efg2.com/Lab/Library/Delphi/Printing
>
> Printer Demo #2 might also be useful since it shows how
> to draw shapes and text to both the screen and the printer:
> http://www.efg2.com/Lab/OtherProjects/PrinterDemo2.htm

thanks much. Excellent link.

bobD


BobD

unread,
Mar 11, 2000, 3:00:00 AM3/11/00
to
Really writing to the printer canvas directly--is it possible to do that
from within the framework of a QuickReport? Haven't looked at that but
assumed that a banded report was not an appropriate tool. Please tell me if
I'm wrong.

What I think I need to do is
1. Create a metafile
2 Create a metafile canvas
3. Set metafile canvas extents/characteristics to match printer page
4 output data to metafile canvas
5 free metafile canvas
6 if PrintPreview.desired then
6a show preview
7 if preview/accepted or not preview.desired then
7a transfer metafile to printer

Is this about right?
I'd like to know I have the basic task outline right before I start
developing program structures, objects, etc. And I'm not too clear about how
to achieve 3, 6a, or 7a.

bobD

canvas
Carsten Bonde <bonde....@eae.com> wrote in message
news:38C8F270...@eae.com...

Simon

unread,
Mar 12, 2000, 3:00:00 AM3/12/00
to
Hi BobD

All I do is write my print routines so they paint on a canvas variable. Then
depending on the user selecting "Print" or "Print Preview", I'll set the
variable to either the printer canvas or to a blank form canvas, and call
refresh. You need to scale things but it works for me.

Simon

0 new messages