Method XbpPrinter():endPage() Foundation
Indicates that the current page has ended.
:endPage() --> lSuccess
This method returns a logical value. If the operation succeeds, :endPage() returns the value .T. (true). Otherwise, .F. (false) is returned.
The method :endPage() ends the current page within the print job. It can only be executed between the calls to :startDoc() and :endDoc().
Calling :endPage() ends the current page but unlike method :newPage(), no new page is begun. After :endPage() returns, the print job is temporarily halted between pages. This can be used by the application to change the following print attributes before the next page is begun via a call to method :startPage():
Attribute | Related method |
---|---|
Page Orientation | :setOrientation() |
Paper Bin | :setPaperBin() |
Form Size | :setFormSize() |
//
// Example for changing print job attributes between
// page breaks
//
#include "Gra.ch"
#include "Xbp.ch"
PROCEDURE Main
LOCAL oPS
LOCAL oDC
// Create presentation space for default printer
oPS := PrinterPS()
oDC := oPS:device()
// Activate spooling and output first page
oDC:startDoc()
GraStringAt( oPS, {20,50}, "Text printed on first page")
// End first page and change page orientation
oDC:endPage()
SetPageOrientation( oPS, XBPPRN_ORIENT_LANDSCAPE )
// Begin and output next page
oDC:startPage()
GraStringAt( oPS, {20,50}, "Text printed on second page")
// End spooling
oPS:device():endDoc()
DestroyDevice( oPS )
RETURN
// Create presentation space and link it to
// device context for printer. The coordinate
// system unit is 1/10 millimeter.
//
FUNCTION PrinterPS( cPrinterObjectName )
LOCAL oPS, oDC := XbpPrinter():New()
LOCAL aSize
oDC:Create( cPrinterObjectName )
oPS := XbpPresSpace():New()
aSize := oDC:paperSize()
// Size of printable region on paper
aSize := { aSize[5] - aSize[3], ;
aSize[6] - aSize[4] }
oPS:Create( oDC, aSize, GRA_PU_LOMETRIC )
RETURN oPS
PROCEDURE DestroyDevice( oPS )
LOCAL oDC := oPS:device()
IF oDC <> NIL
oPS:configure()
oDC:destroy()
ENDIF
RETURN
// Change page orientation. The previous page
// must have been ended using :endPage()!
//
PROCEDURE SetPageOrientation( oPS, nOrientation )
LOCAL oDC := oPS:device()
LOCAL aSize
IF oDC == NIL
RETURN
ENDIF
// Change page orientation and reset
// page size of the associated
// Presentation Space used for
// printing
oDC:setOrientation( nOrientation )
aSize := oDC:paperSize()
aSize := { aSize[5] - aSize[3], ;
aSize[6] - aSize[4] }
oPS:Configure( oDC, aSize, GRA_PU_LOMETRIC )
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.