Click to See Complete Forum and Search --> : Printer Object Replacement


Reid Robbins
October 11th, 1999, 02:56 PM
I have finally gotten totally disgusted with the VB printer object. Since VB 4.0, it has been fraught with bug after bug. The worst problem has been (for me) that since SP 2.0, it is no longer possible to use API calls to bypass the VB printer object's manifest inadequacies. Specifically, I need to be able to use rotated print and from SP 2.0 on (in VB 5.0) to the current release (VB 6.0) the means detailed in KB article Q119673 no longer works "by design". Apparently, MS doesn't feel this is an essential ability. I do. The only workaround offered is to use API calls for ALL your printing since you can no longer mix API calls and VB functions within a single Device Context. Therefore, out of desperation, I have written my own printer object. I am offering it free for personal use to ANYbody who wishes to use it in exchange for its exposure and subsequent beating-upon in the interest of increasing its relability and robustness. New ideas are encouraged. It has the following new abilities and limitations:

NEW ABILITIES
1) There is a property "FontAngle" which allows the use of rotated print.
2) It offers a property, "DocumentName" which allows your document to appear in the print queue with a name other than "Microsoft Visual Basic".
3) It does not spontaneously lose and/or change font attributes as the VB object does.
4) It offers new methods "DottedLine", "DashedLine" and "DrawPointMarker" which aid in graphing. The VB object does not support dotted or dashed lines at more than a 1-pixel width, which my clients termed "wimpy" and "unreadable". The dotted and dashed lines produced by these methods are substantially bolder. The "DrawPointMarker" method produces a variety of markers like square, triangle, inverted triangle, circle, filled circle, cross, crossed ellipses to mark specific points of a graph.
5) The NewPage method does not cause the ejection of blank pages when a subsequent EndDoc method is invoked.
6) A new method "PrintEffect" allows the creation of printing in which the letters are outlined, created by lines radiating from a point, faded color (left-to-right or top-to-bottom), changing color (left-to-right or top-to-bottom) and letters created by a series of concentric ellipses.

LIMITATIONS:
1) You are calling DLL functions, not using VB, so syntax will be different in several instances (mostly with the "Print, "Circle" and "Line" methods). Nevertheless, most changes to existing programs retofitted can be done with search-and-replace, with some manual changes. For new development, it adds little to no burden on the developer.
2) VB refuses to believe in the existence of methods named "Print", "Line", "Circle" or "PSet" outside of its own objects. This object's corresponding methods are, therefore (out of necessity) "SPrint", "SLine", "SCircle" and "SPSet".
3) The "SPrint" method does NOT generate an automatic linefeed. You must use a subsequent "SPrint vbCrLf" to achieve this, unless you (like myself) are in the habit of always using CurrentX and CurrentY to do you positioning before each Print.
4) The SPrint method can also only accept a single string argument.
5) The Tab() argument to the Print method is not recognized.

Within these (as I have found them) minor limitations, this new object has finally set me free from the annoyance of problems MS seems unwilling to recognize, address--or fix.

If you would like to use this object, please let me know. For personal use, it is available without restriction. If you are a developer and would like to use it, it will be free for evaluation and if you want to incorporate it into a product, let's make a deal. I like money, but am primarily interested in getting the VB printer object's "monkey" off my own back.




Reid Allen Robbins
2205 E. Teton Blvd.
Green River, WY 82935

Lothar Haensler
October 12th, 1999, 02:45 AM
sounds interesting.
is your solution an ActiveX DLL or a "regular" C(++) DLL?
Any chance to get access to the source code?

johnk
October 12th, 1999, 07:50 AM
I am an obsolete techie trying to manage a small business applications development group. We use Crystal Reports exclusively. As a manager, I am frequently frustrated by (1) some lack of direct control of placement conditional print items on the page, and (2) the extra programming steps sometimes required to gather data together before sending on to Crystal.

Do you think your Printer Object could help?
Have you looked at Active Reports from Data Dynamics?

John Kisner
J.L.Kisner & Co., Inc.
Greenville, SC, USA
864-233-6941

Reid Robbins
October 12th, 1999, 08:16 AM
This is, indeed, a C++ DLL. It is dynamically linked to the MFC library, so it "carries" with it the MS modules MSVCRT.DLL and MFC42.DLL in the setup.
I might be persuaded to let loose a copy of the source provided I had a firm agreement not to promulgate it beyond your own use in any way. I am hoping to license this module to my employer since I originated it (on my own) to solve problems encountered in my professional work. That could become impossible if too much distribution of source was allowed. However, within the limits I have indicated, I would probably let an occasional interested party have a copy of at least that portion of the code which encapsulates the object's methods and properties.

Reid Allen Robbins
2205 E. Teton Blvd.
Green River, WY 82935

Reid Robbins
October 12th, 1999, 08:21 AM
I doubt that this new object could help you much in the arenas you indicate. Almost its sole advantage consists in obviating certain bugs chronic in the VB object. Except for several new methods, added for some extra "gee-whiz" value, it should be viewed as exactly equivalent to the native VB printer. If you've been using Crystal Reports rather than writing a report in code, I can see no real benefit. Sorry.


Reid Allen Robbins
2205 E. Teton Blvd.
Green River, WY 82935

johnk
October 13th, 1999, 07:34 AM
Thanks for the response. We still might be a candidate for your object as I am looking for options to our appraoch to creating printed reports.

John Kisner
J.L.Kisner & Co., Inc.
Greenville, SC, USA
864-233-6941