Centering

Centering places the image so that it is centered around a point, normally the physical center of the page. You can think of page centering as a way of specifying the relative widths of borders formed when two unequal pages are placed on top of each other. For example, if all the borders are equal relative to each other, the pages are placed on exact centers. If there is no border on the left, the centering is flush left.

When either the clipping or tiling option is selected and an undersize page is printed, the image is centered. You can also specify that the image be centered around a center point other than the physical center of the page.

Printing services provide the set of constant page center values shown in Figure 96.


If you need different centering placement than the available constants, you can compute the necessary positioning. Centering is measured in terms of offset distance from center-to-center placement. The page description object has a function call, SetPageCenterByDisplacement, that specifies this distance given a destination page and a scaling factor, if any. Derived classes can override this function to provide exact placement at print time. The displacement can be an absolute position if desired, or it can be a relative displacement based on the relative sizes of the source and destination pages.

The relative displacement is specified in terms of the distance from source edges to destination edges as shown in Figure 97.


You calculate the center displacement with the following formula:

Center displacement = [(nx-dx)/2(nx/dx)),(ny-dy)/2(ny+dy))] (D-S)

The quantity within the square brackets is independent of both the source and destination sizes but allows centering to be specified relative to whatever sizes might occur.

For example, you have a page 8 inches wide and 10 inches tall and you want to print a card 5 inches wide and 4 inches tall on the page. as shown in Figure 98. You want the placement to be such that the left border is 5 times bigger than the right and the bottom border is 11 times bigger than the top.


To determine the proper placement, you can take the two different size pages representing the source and destination pages and place them on top of each other in the correct relative positions. The pages do not have to be the same size as the actual source and destination as long as they are positioned in the same relative positions as the actual source and destination pages.

To get a TPageCenter value, measure the distance from edge to edge and use these to construct a TPageCenter directly. In this case:

nx = 2.5, ny = .5, dx = .5, dy = 5.5

    TPageCenter myPageCenter(2.5, .5, .5, 5.5);
This ratio works out to the same as the requirements that the left border be five times larger than the right border and that the bottom border be 11 times larger than the top border.

Calling GetPageCenter without first setting a different page center always returns a perfectly centered TPageCenter value by default, therefore pages are always perfectly centered by default. A perfect center value is (1,1,1,1) or (3,3,3,3).

NOTE The page centering technique works well only for source pages that remain enclosed by the destination page. Source pages that lie off the page will still work, but it is harder to control their behavior. You should use a transform on the content itself to get the desired appearance.

Matching dissimilar pages

When two page descriptions do not match, and a mismatch option is selected, the system maps the physical page size and the printable rectangle to the printer page description. For example, if the scaling option is selected, not only are the physical page sizes scaled, but the printable rectangles are scaled so that they are not clipped. When the page descriptions are mapped, it must still be possible to rotate the page 90xb0 . If multiple input pages are tiled to the output page, all the constraints must still be met.

Figure 99 shows a simple case of page mapping where multiple source pages are mapped to a single destination page using the tiling option. The active areas of the pages are determined by the active rectangle specified in the page descriptions. The source and destination pages do not have to be described by the same page description. In this example, the active area is the printable area of both the source and destination, and the mapping frequency is taken to be n by m source pages per destination page.



[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker