by Peter Castle (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating:
(2 Votes)
The PrinterSupport.dll was created in order to simplify printing documents. Included features are;
1. Paragraphs
2. Rectangles
3. Circles
4. Pictures (picture object reference)
5. format text (i.e. bold, size, etc)
6. Justification (full, left, right and centre)
The printing is done using millimeters so that replicating documents for programs is relatively straight forward. The non-printable area of the printer is also taken care of.
Note:
The printer orientation is not modified at all but can easily be added if need be.
There is also no current method of selecting a printer which can also be added to the dll if required.
Assumes
To use PrinterSupport.dll, you need to do the following;
1. Create a reference to the dll in a project
2. Declare a variable as follows
Dim objPrinter As New PrinterSupport.MyPrinter
3. When printing it is important to treat the document you are doing like a recipe. In otherwords take it step by step. eg;
objPrinter.FontSize = 8
objPrinter.FontBold = True
objPrinter.PrintCentre 105, 280, strCopyHeader
objPrinter.FontBold = False
objPrinter.FontSize = 10
the above sets the font size to 8, then sets the bold property to true. This will stay that way until set to something different as is done after a variable is printed at X=105, Y = 280 using centre justification for a line of text.
Note:
To set justification for a paragraph you need to set the justification method BEFORE printing the paragraph.
Download PrinterSupport (19 KB)