Draw a Page

Draw a Page into a Supplied Device Context

  • Use the VAPIMWP_DRAW_INIT parameter of the VAPIM_DRAW message to initialize the drawing routine in VAPI. You must send this parameter before you open the document by using the VAPIMWP_INIT_OPEN_DOCUMENT message.

  • To get the number of pages in a document, open the document with the bWait parameter in the TPVAPIOpenDocumentInfo structure set to TRUE, and use the VAPIMWP_DRAW_GETPAGECOUNT parameter of the VAPIM_DRAW message. See VAPIMWP_INIT_OPEN_DOCUMENT for more information. You can set bWait to FALSE if you do not want to wait for the whole file to be processed and just want to get the size of the first few pages and draw the first few pages, or if you want to draw pages in any order.

    For spreadsheets, you must use the VAPIMWP_DRAW_GETPAGECOUNT parameter to draw the worksheet pages successfully. To change the worksheet, use the VAPIM_MULTIOBJ message. See VAPIMWP_MULTIOBJ_CANMULTIOBJ for more information.

  • To get the size of the specified page, use the VAPIMWP_DRAW_GETPAGESIZE parameter of the VAPIM_DRAW message.

  • To draw the specified page into the supplied device context, use the VAPIMWP_DRAW_DRAWPAGE parameter of the VAPIM_DRAW message.

  • To create a thumbnail image file of a document page, use the VAPIMWP_DRAW_DRAWTOFILE parameter of the VAPIM_DRAW message.