Discussion:
printer.canvas print preview?
(too old to reply)
Dr J R Stockton
2012-06-30 19:57:46 UTC
Permalink
I have an over-seven-year-old Delphi 3 console-mode program which reads
ASCII text files and writes them to printer.canvas (user choice of font
face/size, portrait/landscape, multiple pages per sheet, pipe in, etc.
Expects monospace font.

Could it be easy to adapt it to alternatively show in a GUI window what
each sheet would look like, instead of or before printing? Compiling
would have to be Delphi 6, I think, or maybe Delphi 3 DCC.EXE.

FYI, it was written for an A4 printer; but, IIRC, it should accept paper
size information.

Files are (Date/time UK, approximate)
2003/09/29-13:11:06 VERSION .PAS 2262 (an include file)
2004/08/11-11:50:28 PRINTEXT.TXT 4897
2005/09/21-14:14:40 PRINTEXT.PAS 16984
2005/09/21-14:16:02 PRINTEXT.EXE 196608 (in ZIP)
2005/09/21-14:17:22 PRINTEXT.ZIP 112771
in <http://www.merlyn.demon.co.uk/programs/> using
<http://www.merlyn.demon.co.uk/programs/00index.htm>
--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk BP7, Delphi 3 & 2006.
<http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<http://www.bancoems.com/CompLangPascalDelphiMisc-MiniFAQ.htm> clpdmFAQ;
NOT <http://support.codegear.com/newsgroups/>: news:borland.* Guidelines
Gunnar
2012-06-30 23:36:11 UTC
Permalink
Post by Dr J R Stockton
Could it be easy to adapt it to alternatively show in a GUI window
just replace the printer.canvas by a Metafile.Canvas.

-Gunnar
Maarten Wiltink
2012-07-03 21:34:20 UTC
Permalink
Post by Gunnar
Post by Dr J R Stockton
Could it be easy to adapt it to alternatively show in a GUI window
just replace the printer.canvas by a Metafile.Canvas.
A metafile? If I am not mistaken, that's a thing that implements a canvas
so as to record what's drawn on it, and can then render itself onto the
next canvas. So if you have the drawing code, it really adds no power
(although obviously it's hugely useful for decoupling and storage).

I think I used a TImage's Bitmap's Canvas when I did this. More convenient
than a TPaintBox, which I guess would have to be redrawn on every
Invalidate, and might require cropping and possibly translating.

Groetjes,
Maarten Wiltink
Jamie
2012-07-03 22:06:13 UTC
Permalink
Post by Maarten Wiltink
Post by Gunnar
Post by Dr J R Stockton
Could it be easy to adapt it to alternatively show in a GUI window
just replace the printer.canvas by a Metafile.Canvas.
A metafile? If I am not mistaken, that's a thing that implements a canvas
so as to record what's drawn on it, and can then render itself onto the
next canvas. So if you have the drawing code, it really adds no power
(although obviously it's hugely useful for decoupling and storage).
I think I used a TImage's Bitmap's Canvas when I did this. More convenient
than a TPaintBox, which I guess would have to be redrawn on every
Invalidate, and might require cropping and possibly translating.
Groetjes,
Maarten Wiltink
Meta files are vector files in nature. They are basically stored as a
sequence of GDI API instructions, not as actual bit images of what ever
compressed format you wish.

if you don't need complex images, then Meta files are great for
template drafting and things like that.

They also do have a raw data area which can be used to store just
about anything, things like bitmaps etc. inline with the GDI stream, all
you do is specify a BMP and you can use that as a raw data store.

That function really caused a lot of problems with the data overflow
that just happen to so nicely, execute code for you ;)

Jamie
Dr J R Stockton
2012-07-04 19:27:42 UTC
Permalink
In comp.lang.pascal.delphi.misc message <4ff3655f$0$6852$***@news2.
news.xs4all.nl>, Tue, 3 Jul 2012 23:34:20, Maarten Wiltink
Post by Maarten Wiltink
Post by Gunnar
Post by Dr J R Stockton
Could it be easy to adapt it to alternatively show in a GUI window
just replace the printer.canvas by a Metafile.Canvas.
A metafile? If I am not mistaken, that's a thing that implements a canvas
so as to record what's drawn on it, and can then render itself onto the
next canvas. So if you have the drawing code, it really adds no power
(although obviously it's hugely useful for decoupling and storage).
I just want a Print Preview for a program which currently outputs only
to Printer, in order to save paper and ink. Using Metafile for that
should be easy enough, except for the amount of Delphi that I've
forgotten in the last few years, and the amount added since Delphi 3.

I do already have an adaptation of a command line BP7/D3 program that
runs as a GUI - longcalc & vastcalc, via sig line 3.

Anyone interested in debugging
<http://nl.wikipedia.org/wiki/Lagrangepunt>?
--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; WinXP.
Web <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms and links.
PAS EXE TXT ZIP via <http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
Jamie
2012-07-05 00:02:04 UTC
Permalink
Post by Dr J R Stockton
news.xs4all.nl>, Tue, 3 Jul 2012 23:34:20, Maarten Wiltink
Post by Maarten Wiltink
Post by Gunnar
Post by Dr J R Stockton
Could it be easy to adapt it to alternatively show in a GUI window
just replace the printer.canvas by a Metafile.Canvas.
A metafile? If I am not mistaken, that's a thing that implements a canvas
so as to record what's drawn on it, and can then render itself onto the
next canvas. So if you have the drawing code, it really adds no power
(although obviously it's hugely useful for decoupling and storage).
I just want a Print Preview for a program which currently outputs only
to Printer, in order to save paper and ink. Using Metafile for that
should be easy enough, except for the amount of Delphi that I've
forgotten in the last few years, and the amount added since Delphi 3.
I do already have an adaptation of a command line BP7/D3 program that
runs as a GUI - longcalc & vastcalc, via sig line 3.
Anyone interested in debugging
<http://nl.wikipedia.org/wiki/Lagrangepunt>?
if you don't want to write any code, install the free PDF print driver.
When installed, it adds a PDF printer to your system. This will generate
a PDF file of your output and of course, you can then view this with a
PDF reader.

There are also Image print drivers that you can install that will
generate an image like a BMP, JPG etc/. That too., also comes up as a
added printer in your system you can select from.

Jamie

Loading...