Hide

SftPrintPreview/DLL 2.0 - Print Preview Control for C/C++

Display
Print

Page Management

Printing output is a simple process, rendering each page sequentially, starting at the first page. Print Preview can be quite more complicated, as a user can display the first page, then jump to the last page, a page in the middle and back to the first page. In order to display the last page, the exact layout of all pages has to be determined to arrive at the last page. Page positioning can therefore be a fairly time consuming process.

SftPrintPreview/DLL offers a very simple mechanism to optimize page positioning, allowing the application to save information after rendering each page, so restarting to produce the next page is accomplished by simply resuming using saved information.

When the drawing callback SFTPRINTPREVIEW_DRAWINFOPROC is called with a function of SFTPRINTPREVIEW_PRINT_ONEPAGE or the OnPrintOnePage function is called, the application renders the requested page. At the end, it can save an application defined value in the member visitedPageInfo of the SFTPRINTPREVIEW_DRAWINFO structure. This value can be a simple long or DWORD value, or a pointer to an application allocated structure. In either case, the value describes the exact output position necessary to resume printing (the next page). SftPrintPreview/DLL saves all these returned values in the SFTPRINTPREVIEW_CONTROL structure and they are accessible through the aVisitedPageInfo member. The aVisitedPageInfo member points to an array of application-defined values of type SFTPRINTPREVIEW_DWORD_PTR, one entry for each visited page (starting at the first page, page 0). Up to visitedLastPage entries are available.

If the application stores an allocated structure, it must be freed by the application. This is best done when the drawing callback SFTPRINTPREVIEW_DRAWINFOPROC is called with a function of SFTPRINTPREVIEW_PRINT_CLEARCACHE or the OnPrintClearCache is called.

When the drawing callback SFTPRINTPREVIEW_DRAWINFOPROC is called with a function of SFTPRINTPREVIEW_PRINT_ONEPAGE or the OnPrintOnePage function is called, the information saved for the preceding page is available to the application in the SFTPRINTPREVIEW_DRAWINFO structure member previousVisitedPageInfo.


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.