ddoc Print and Preview v1.9d abstracted windows printer interface Programmer's Manual
Version 1.9d
|
What's Installed
[ddoc samples]
ddoc\samples
ddoc\lib
ddoc\docs
ddoc\include
ddoc\source
windows\system
Distribution and Support
ddoc header files may not be distributed or published in any form except as part of the tryddoc.exe
evaluation package. Support for ddoc is provided via e-mail -
don@greatwebdivide.com. I respond as quickly as possible, but if I get stuck out of town it can
be a few days before I get back to you. Information on obtaining the latest versions is available on my
web-site: dickinson.basicguru.com
More than just print and previewing
This file is an install program that installs ddoc.exe in the user's windows\system directory and
registers the file extension, .ddc, in the registry automatically. Your end-users can give this
installation to anyone who wishes to print and view .ddc documents.
Summary of features
Getting Started With ddoc Print and Preview
The idea of ddoc is to allow the programmer to construct one routine to print or
preview a document. Pass one parameter letting the ddoc engine know whether s/he is printing or
previewing the document. What happens behind the scenes is akin to creating a Windows Metafile -
as you make calls to the ddoc32.dll library, these calls are recorded and stored in a proprietary
document file. It is important (especially for those used to printing from DOS) to remember that ddoc
is page oriented, not line oriented. This means that the programmer is responsible for telling the
engine where to print on the page and maintaining their current position on the page. This is a very
powerful concept as it allows the programmer to draw text at any place on the page and in any order.
After completing a page, call dpNewPage to start the next page or dpEndDoc to end the document and
either preview or print it. The dpEndDoc call initializes the actual print engine which either displays
or prints the document. The following is a short VB skeleton program:
ddoc Print and Preview is installed via an industry standard installation program.
Because you're reading this text, I'll assume that it is installed Ok.
ddoc makes the following entry in your win.ini file:
ddoc=c:\code\ddoc
It also registers the .ddc extension so that if you double-click on a .ddc file
in the explorer, the file will be called up by the ddoc.exe that's located in
your windows\system directory. Note that if the .ddc extension is already registered,
the installation process will not overwrite what's there. For additional information
on the ddoc and the registry, see the Registry section later in this text.
Inside the ddoc directory, you'll find the readme.txt file that explains your
license and the contents of the sub-directories. In addition, there should be a
file called history.txt that contains known bugs, features that may be available in
future releases, and revision history. The following sub-directories should have
been created:
This directory contains one sub-directory per language supported (vb3, vb5,
Delphi 16-bit, Delphi 32-bit, pb/dll 16-bit, pb/dll 32-bit, and pbcc 32-bit).
Note to pb/dll users, you must provide your own copies of winapi.inc (16-bit)
and win32api.inc (32-bit) in order to compile the sample programs, as these files
are kind of big and I didn't want to worry about distributing them.
This directory contains the ddoc Print and Preview engine:
All 4 files may be freely distributed with your applications.
This sub-directory contains the HTML formatted manual for ddoc.
This directory contains the header files for all programming languages supported:
It also contains the ddocml.ini mailing label definition file. You will need this
file if you are going to take advantage of ddoc's built-in mailing label functions.
PB/DLL 6 source code for ddoc.exe, ddoc16.dll, and ddoc32.dll. If you need to recompile,
please see the source files for instructions. The main files for each of the dll's and
the exe are ddoc.bas (for ddoc.exe), ddoc16.bas (ddoc16.dll) and ddoc32.bas (ddoc32.dll).
Note that you must own Power Basic DLL compiler v6 or 7 (or v2/1.x for 16-bit) to recompile
the source (go to www.powerbasic.com). The
source for ddoc_jpg.dll is also included. This source requires Delphi 6 to compile
and consists only of ddoc_jpg.dpr and u_jpg.pas. Questions
about the source code will be answered (at my discretion and if time permits) via e-mail -
don@greatwebdivide.com.
Note: source code is included with the registered version only.
The installation process also puts the 4 ddoc library files in your windows\system directory
(Win95-98) or in your windows\system32 directory (Win NT).
Note: The vb3 and vb5 sample programs require their respective runtime libraries be
present as they are not provided with the demo. If you don't own vb3 or vb5, you won't
be able to execute their exe's without obtaining the runtimes.
Purchasing ddoc allows you the right to freely distribute ddoc.exe, ddoc_jpg.dll, ddoc16.dll, and ddoc32.dll.
If you have a 16-bit program, you need to give out ddoc16.dll, ddoc32.dll, and ddoc.exe. For
32-bit programs, you only need distribute ddoc32.dll and ddoc.exe. ddoc includes source code
(see above). You only need to distribute ddoc_jpg.dll if your program needs jpg support
(via the dpAddGraphic command). You may not under any circumstances distribute, publish, or sell the source to ddoc.
It is for your use only. I provide it for the express purpose of allowing the user to modify and
recompile it to suit their needs and distribute the compiled result royalty-free with their applications.
Any other use is strictly forbidden.
ddoc Print and Preview is now much more than just a Print and Preview engine. It is capable of
saving out it's preview screen as either a native .ddc file or a self-extracting .exe file. This
feature is sort of like Adobe Acrobat®. You can save out the .ddc files and call them up on
the screen any time you wish. All you need to call them back up is the viewer - ddoc.exe. Because
.ddc files may be distributed to someone who doesn't own ddoc.exe, I allow anyone to download and
install ddoc.exe on their computer. You can feel free to link to this
program from my web-site.
ddoc gives a Windows Programmer an abstracted print and print preview API. This small engine is
designed to replace the VB3,4,5 printer object, the Delphi TPrinter object, and any other less
powerful print or preview engines provided with programming languages. Power Basic PBDLL programmers
will especially benefit because their language provides no printer support save going directly through
the Windows API.
Dim hFile as Integer
Ok, the code above isn't so bad - most of the lines are comments! But, it gives you
an idea of how the engine works:
'- Initialize the viewer. Give it a title. The third parameter contains the
' name of the temporary file in which the document will be stored. Since a
' null string is passed, the viewer will create a unique temp file for the
' document. If you have the urge to know what the document is called,
' see the dpGetFileName function. Other parameters tell the engine that
' all calls will be made in inches (as opposed to the centimeter option),
' that the document's first page will be portrait, and that the display
' engine should come up and zoom the first page to fit in the viewer's
' maximized window.
'
hFile = dpStartDoc (0, "Title", "", DDOC_INCH, DDOC_PAPER_LETTER, _
DDOC_PORTRAIT, DDOC_SYSTEM_DEFAULT, DDOC_ZOOMFIT)
if hFile < 1 then
MsgBox "Error initializing the document:" + str$(hFile)
else
'- Document is started, first thing to do is always set
' the font specs. (Blue, bold, 11 point, arial).
'
dpFont hFile, DDOC_FONTBOLD, 11, vbBlue, "Arial"
'- Now print some text to the viewer
dpText hFile, .5, .75, DDOC_LEFT, "Left Aligned Text, at (.5, .75)"
'- End the document telling the engine to display the
' the document on the screen. Also, the delete flag
' is set, telling the display engine to delete the
' temporary file that the document is stored in when
' the user exits the document. Note, that the document
' can be redisplayed (if not deleted) by passing the
' name of the document on the command line to ddoc.exe
'
dpEndDoc hFile, DDOC_END_VIEW or DDOC_END_DELETE
end if