Print Preview Component
v1.05 October 24, 1995
Adds *easy* Print Preview capability to any Delphi Application
Print Preview supports:
- Zoom from 10% to 5000%
- Zoom tool allows zoom in/out on a specific location
- Hand tool allows easy panning across the page
- One Page or Two Page displays
- Portrait or Landscape page orientation
- Printing Status display with CANCEL and cooperative
multi-tasking
- Tool Tips & Hints for iconic buttons
- Status bar displays page, zoom level, and hints
- Customizable Grid verifies margins & layout
- Page Navigation buttons go to first, previous, next,
last page, or by number.
Programmer Benefits:
- One set of routines for Printing & Previewing
- Supports all TCanvas routines (except for PenPos & Pix
els)
- Built-in routines eliminate round-off errors for
pagination
- Automatically clips non printable area on Preview
- Returns the true physical page size (not just
printable area)
- Returns all printer info (page size, printable area,
pixels/inch, etc)
- Conversion routines for inches to printer units
- All Preview Screen scaling performed automatically
- Programmer can implement Exception Handling to catch
Print Preview Errors
- Simple & Advanced print pagination is supported
- Customizable Preview Form
-Show/hide buttons
-Change the title
-Select min, max, and step for Zooming
-Set initial settings
Fully functional - not crippled in any way
The unregistered version of this component has an "About" box on
the Preview screen that indicates the component has not been reg
istered.
Installation
1. Copy the files PREVCOMP.DCU, PREVCOMP.DCR, *.DFM, and *.RES
to your DELPHI\LIB directory.
2. From the "Options" Menu, select "Install Components". Press
the "Add" button, and then the "Browse" button. Go to the
LIB directory, and select UNIT file types (*.dcu). Then
select PREVCOMP.DCU and press "OK". Then press "OK" for the
Install Components dialog box.
3. When Delphi is done compiling there will be a new component
in your "Samples" palette called PrintPreview.
Note: A common installation problem is to get a Unit mismatch
error. To remedy this, be sure to *completely* remove any old
versions of the Print Preview component. Also, be careful that
there aren't any other units (*.dcu, *.pas) that have the same
name in your include path.
Testing the Print Preview Component
A sample project is already provided. Open the project called
TESTPREV.DPR and run it. Note: you must install the Print Pre
view component before opening and running the test project.
When the program starts, you are given four page tab control
(Text, Table, Graphics, and MultiPage). Select each page and
press the Print Preview button to view the demo. You may change
some of the options for each of the examples.
Once inside the Print Preview screen, you can zoom in or out
(with the buttons or by clicking with the mouse). The Hand tool
can be used to move the page around (only if it is larger than
the screen). You can select a one page or two page view. In the
MultiPage example, you can advance to the next page, or move
back.
Advanced
To use the Print Preview component in your own projects, simply
drop the component on your form. Then register the three events
(Begin Print, End Print, and Print Page) with your own routines.
Refer to the Test project sample code, or to the PRNTPREV.INT
file for technical details on interfacing with the component.
The sample project code shows 90% of what can be done with the
component.
Important Note: Any file that uses the Print Preview component
MUST add "PREVTYPE" to the USES clause.
Shareware Registration
This component is shareware, and is distributed to be used for a
limited trial period of 30 days. You are free to copy and dis
tribute this software in unmodified form. After the 30 day
period the software should be registered or removed from the
user's system. If the component is to be included in a commer
cial or government application, it must be registered (i.e., paid
for).
The registered version of the component offers additional bene
fits: 1) the ability to hide the "About" box on the Preview
screen, or replacing it with your own custom button & procedure;
2) technical support via email or phone (you pay the long dis
tance though); and 3) the complete source code for the component.
Pricing and Ordering Information
Registering Print Preview is U.S. $20. This provides you with
the source code to Print Preview, and technical support for using
Print Preview. Note that support is only provided for unmodified
version of the source code. If you have email I can just email
you the registered component (and source code).
Send a check or money order to:
Print Preview Component Software
Care of: Ben Ziegler
210 E. Fairfax St #624
Falls Church, VA 22046
Make checks payable to "Ben Ziegler." When you register I will
send you my phone number for technical support. Note that I can
only take calls after work.
Compuserve Registration - GO SWREG account #7957 ($20). If you
need a disk mailed outside of the United States, an additional $5
will be charged. However, if you want it mailed through Compus
erve, simply choose "United States" so as not to be charged the
additional $5. Also note, that even though SWREG may display an
older version of Print Preview, I will send you the most up-to-
date version.
Where to Obtain the latest Version of Print Preview
I upload the lateset version to Compuserve (GO DELPHI, Library
"VCL") and to the Delphi Super Page on the World Wide Web (URL =
http://sunsite.icm.edu.pl/~robert/delphi/). When you register
the software you will always receive the latest version.
Questions, Comments, and Suggestions
I'd love to hear any questions, comments, or suggestions you may
have (and yes, even bug reports). I can also be reached on email
at [[Email Removed]].
Thanks for trying my Print Preview component!
-Ben
Revision History
Version 1.00
Released Sept 23, 1995
Version 1.01
Released Sept 25, 1995
Bug Fix: Added *.DFM and *.RES files so could install the
component
Version 1.02
Released October 9, 1995
Bug Fix: Fixed a serious memory (GDI) leak. TspecialCanvas
destructor now declared as "override" (as it should be!)
Documentation changed to Word for Windows 6.0 format
Print Preview Types now moved to PREVTYPE.DCU
Source Code now free with registration
Preview Component now named PREVCOMP instead of PRNTPREV
Version 1.03
Released October 12, 1995
Added SWREG information for Compuserve
Version 1.04
Released October 22, 1995
Renamed ABOUT.PAS to PVABOUT.PAS for less conflicts with
other programs
Fixed bug for printer drivers with X resolution <> Y resolu
tion
Added Xcm and Ycm functions for Metric support
Added a button bar on the status panel to move to the first
page, previous page, next page, last page, or to any page by
number.
Added a $DEFINE Registered to easily remove the shareware
About box
Improved the accuracy of text on the screen. Added a
TspecialCanvas function called TextOutFast that is faster but
less accurate.
Added a read-only CanvasMode property to TSpecialCanvas so
that the print routines can know where they are printing too.
Added a new CanvasMode called cmPaginate. This makes pagina
tion much simpler since the routine can expect to never
receive a page that is more than 1 greater than the last page
(but still must be prepared to go pack to print earlier
pages). When in this mode, output is sent to "nowhere," but
TextWidth information, etc is still called from the Printer.
Added pagination status to the Preview form.
Version 1.05
Released October 24, 1995
Bug fix: Added Printer.EndDoc after Printer.Abort. Now you
can cancel a print job and still print again.
MAJOR BUG FIX: I now treat the Printer object as VOLATILE -
as it should be since it is global and I have no control over
it. Before all print routines, the required printer param
ters are set to the correct values. This fixed problems of
the fonts not being what they should be, etc.
Text for the printer is now set to transparent by default.
This is a better option since the programmer can always do a
Rectangle with the desired background before doing a TextOut.
Bug fix: The user can now use Printer Setup from within the
Print Dialog box. I accomplished this by closing down the
Print Preview screen before going to the Print Dialog (this
is a feature, not a bug!) so that it now works.