|
|
Introduction
qPrinter 1.6 allows programmers to add good quality
print support to their applications. Documents can be
constructed and edited through code. The Visual Basic Printer
Object is extremely basic. When you have been using Visual
Basic and Object Orientated Programming it is surprising to find how
poor the Printer Object is in VB. Even simple features like
basic word wrap facilities are not supported and most 'properties'
include a disclaimer from Microsoft that their functionality is
dependent on the Printer driver.
qPrinter overcomes some of the problems a coder is
faced with when using the VB Printer Object and simplifies creating
attractive documents from code. qPrinter allows the programmer
to show a Preview of the printed document and allows both the coder
and the user to determine Printed output including the number of
copies and collation.
Documents are constructed in qPrinter by adding
TextItems. Each TextItem has properties for changing font,
style, alignment, borders and indenting. TextItems are printed
in the order they are added to the document. All of the
TextItem properties can be edited after they are added including the
Text. TextItems can also be set as 'Absolute' so they will
always be printed at an exact position on a particular page.
Text within a TextItem can contain HTML style
formatting tags that will change the appearance of the text.
These include font characteristics, styles, alignment and
indentation.
qPrinter also includes built-in Headers and
Footers. These can be different for Odd/Even pages and
First/Last pages.
With version 1.6 the FormPrint method was
added. This allows the programmer to pass a form reference to
qPrinter and the method will construct a document based on the Text
based controls on the form. The document will use the font
properties of the original control. Where the text in a
control is greater than the size of the control, the FormPrint
method can be set to expand the area designated for the control to
show the full text. Where Option boxes have been used qPrinter
will only show the selected Option in the most appropriate position
relative to the other controls.
The download contains the complete source code for
the project as well as an example project. Load the
PrinterTest project group. There are two examples
included. One displays a Standard Document showing some of the
features, the other shows an example of the Form_Print method.
The Project is available for VB6 (English or Dutch) or VB5
(English).
| Features in qPrinter 1.6.0 |
| FormPrint |
This is aimed at replacing the
'PrintForm' method of Visual Basic - the pixilated screen dump
of the form. The 'FormPrint' method analyses the
controls on the form/container control and creates a qPrinter
document from these items. The method looks at the
properties of each control to determine the formatting
options. |
| Formatting
Options |
Formatting options include: Font,
Borders and Shading, Indenting both left and right,
alignment of text (including full justification) and Absolute
positioning. |
| Inline Style Tags |
Style and formatting options can
be changed within Text using HTML style tags. These
include Font options and Indenting. |
| Headers and
Footers |
Different Headers and Footers can
be set to be printed on the First Page, Odd Pages, Even Pages
and the Last Page. Date and Application information can
be included using Field values. |
| Printing Options |
Page ranges, Destination Printer,
Copies and Collation options. |
| Preview Options |
Zoom options including Page Width
and Full Page. Move directly to specific page. |
| |
|
| Basic Features of qPrinter and
how a document is constructed |
| Working with the
Visual Basic Printer Object |
qPrinter provides an enhanced
printer object with the ability to manipulate text. The
project allows the user to Preview the printed output.
The routine for drawing the printed output is based on
measurements taken from the VB Printer Object. As the
Printer Object doesn't support word-wrap, qPrinter measures
words and characters and wraps text within a specified
boundary. |
| Document
Construction |
Documents are constructed by
adding TextItems. Each TextItem has its own font,
indentation, border and alignment properties as well as the
Text to be printed. A TextItem could be a single word or
several pages. The TextItem's properties can be edited
at any time. |
| Text Flow |
TextItems are printed in the
order they are added to the document. For example the
first Item may be a Title. The second item could be the
document body. |
| Absolute Items |
A TextItem can be set as
'Absolute'. In this case you can specify where it should
be positioned exactly on the page. It will be printed
independently of 'Text Flow' items. You can specify the
exact page it should be printed on or use it to print a
watermark on every page. |
| Text Features |
qPrinter handles word-wrapping,
font, font size, font color and alignment. This includes
the ability to fully justify text (e.g. maintain a straight
vertical line down both margins). |
| Borders and
Shading |
qPrinter can draw a border around
a TextItem and add shading to the area covered. |
| Previewing |
A preview window can be called to
show the document and the user can move through the pages of
the document. Zoom features include the ability to show
the full page and page width. |
| |
|
|
|
|