Page breaking algorithms are responsible for the task of splitting the content of a document (text, images, footnotes, ...) into pages, respecting a set of rules stating where page breaks are allowed and where they should be avoided. In doing this, these algorithms should also guarantee that the content placed into each page fits the available area without leaving any unexpected space, but this desirable feature is not implemented in existing pagination applications, forcing users to manually adjust some properties (such as word spacing, letter spacing, etc.) to locally valid values page by page. We describe an algorithm that, on the contrary, works automatically and globally on the whole document, building a set of
page breaks that require a minimal set of adjustments in order to fill perfectly the available space. Users can guide the algorithm by setting a list of properties that can be modified; the list also specifies the priority order in the adjustment of these properties. The algorithm has been implemented into Apache FOP; the list of properties and the request for an optimized set of page breaks are set directly into the input files as extensions to the XSL-FO standard.