Print a Document
The prntdemo sample program demonstrates how to print by using the Viewing API.
To print a document
-
Open the document. See Open and View a Document.
To make sure that the entire document is opened before the document is printed, open the document with the
bWait
member in the TPVAPIOpenDocumentInfo structure set toTRUE
.To print a document without viewing it, open the document with view mode disabled.
-
Use the VAPIMWP_PRINT_CANPRINT message to determine whether a document is completely processed and ready for printing.
-
Optionally, use the VAPIMWP_PRINT_PRINTHEADER message to print the file name, page number, and page length at the top of each page of a printed output.
Used in conjunction with
VAPIMWP_PRINT_PRINTHEADER
, the VAPIMWP_PRINT_SETPRINTNAME message replaces the default file name field of the header with another string. -
Optionally, use the VAPIMWP_PRINT_PRINTTOPD message to set the standard Windows print options.
-
Optionally, use the VAPIMWP_PRINT_PAGESETUP message to set print page scaling for a spreadsheet.
-
Use either the VAPIMWP_PRINT_PRINT message to print by using a common Print dialog box or the VAPIMWP_PRINT_PRINTTOPRINTER message to print to a specific printer without a Print dialog box.