|
Advanced printing features only
in the Document Imaging SDK
The main features
of the advanced printing component of the Document Imaging
SDK are the composing module for photo printing, complete
integration with the Black Ice printer driver’s technology,
and a full set of ActiveX controls for VB and .NET. Several
high level functions are available to compose a
page for photo printing with visual controls. The
photo composer module allows developers to create the layout
of the final printed page by programmatically specifying
the position and size of an image on the paper in inches,
millimeters or even pixels. Pictures can also be positioned
by manually dragging the photos on the page or by
aligning the photos on the page to the center, to
the left, or to the right. In addition, cropping and
scaling is built into the photo composer module with
a convenient drag and drop interface for photo
importing. Usually only C or C++ developers can take full
advantage of printing devices, but now the Document Imaging
SDK includes unique printing capabilities for .NET
and VB developers, which are not available in any other
Imaging SDK's. Some of the key features of the
advanced printing are the options for developers to access
and modify the printer’s "DEVMODE", from all
of the main programming languages. The advanced print module
is completely integrated with the Document Imaging
SDK. The Black Ice Advanced Printer Driver technology includes
over 300 functions to control every aspect of the printer
driver configuration and printing process. Now,
Visual Basic and .NET developers can retrieve and
set individual printer settings such as orientation, resolution,
and page size. The advanced printing features of the Document
Imaging SDK can be used together with the Black Ice printer
drivers and this way application developers gain access
to high-end document conversion features. By combining
the document conversion features of the Black Ice printer
drivers with the document and image manipulation features
of the Document Imaging SDK, developers can create robust
systems that can address any document imaging task.
All of the advanced
printing features are also available for VB.NET, C#, VB,
Delphi, etc. developers through the Active X controls which
ship with the Document Imaging SDK. The Active X control
contains all of the same powerful features as the C or
C++ interface.
Printing from C code
The first step
is to retrieve the printer’s devmode. Pass the handle retrieved
by the OpenPrinter() function to the GetPrinter() function
with the PRINTER_INFO_2 type structure. Printing a document
to a printer is very similar to displaying the document
on the computer screen. The developer has to draw the contents
of the document to the printer’s Device Context as he would
draw them in a window DC. In order to create a Device Context
for a particular printer, use the CreateDC() API function.
hDCPrinter = CreateDC("WINSPOOL", szPrinterName,
NULL, pi2->pDevMode); To start the printing process
call the StartDoc() function. Pass the handle to the DC
returned by the CreateDC function, and pass the pointer
to the DOCINFO type variable. Specify the name of the document
you would like to use in the lpszDocName member of the
DOCINFO structure. Applications should call the StartDoc
function immediately before beginning a print job. This
function ensures that pages from multipage documents will
not be mixed with other print jobs. The value returned
by StartDoc can be used to retrieve or set the priority
of a print job. The developer can call the GetJob or SetJob
functions and pass the value returned by the StartDoc function.
Use the StartPage() function to start new page. The StartPage
function prepares the printer driver to accept data. Printing
(drawing) a page ends when the EndPage() function is called.
The actual drawing of the document must happen between
the StartPage and EndPage function calls. The EndPage function
notifies the printer driver that the application has finished
writing to a page. This function is typically used to direct
the device driver to advance to a new page. Use the EndDoc
function to end the print job. The EndDoc will notify the
printer driver that the job is ended and no more pages
are printed. |