# Print a Document

The prntdemo sample program demonstrates how to print by using the Viewing API.

To print a document

1. 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 to `TRUE`.

   To print a document without viewing it, open the document with view mode disabled.

2. Use the VAPIMWP_PRINT_CANPRINT message to determine whether a document is completely processed and ready for printing.

3. 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.

4. Optionally, use the VAPIMWP_PRINT_PRINTTOPD message to set the standard Windows print options.

5. Optionally, use the VAPIMWP_PRINT_PAGESETUP message to set print page scaling for a spreadsheet.

6. 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.

© Copyright 2016-2020 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm