2022.2

Table Of Contents
scale
Scale at which to draw. To draw at the 100% size, use a scale of device_dpi / 72. Do not use the DC
to do the scaling; this will result in scaling artifacts being drawn.
offsetX
Horizontal offset from the left edge of the DC surface, in *device* units, at which to start the drawing.
offsetY
Vertical offset from the top edge of the DC surface, in *device* units, at which to start the drawing.
The drawing is done in PDF user space units (72th of an inch). In order to have a smooth drawing of the
page, the device context must have its mapping mode set to MM_TEXT with a 1:1 mapping between
logical space (SetWindowExtEx) and device space (SetViewportExtEx). Since MM_TEXT has its origin
at the top instead of the bottom, the drawing is done vertically mirrored; this means that the other map-
ping modes may not work because they are based at the bottom. A 100% zoom is obtained by setting
the scale to the ratio of the device dpi divided by 72.
The Acrobat library automatically clips the drawing based on the viewable portion of the DC. If the DC is
translated or scaled, either by a world transform (SetWorldTransform) or a logical-to-device space
transform (SetWindowOrgEx or SetViewportOrgEx ), the *untransformed* space is used. As a result, all
scaling and translation operation must be done by the library itself to work correctly. Otherwise,
unwanted scaling artifacts or clipping will occur.
As such, the drawing code of the caller should look similar to this to obtain the same result as what
Acrobat does:
1. Fill the entire drawing area with gray.
2. Determine the origin (orgx, orgy) (for example, at (0, 0), or as indicated by scroll bars).
3. Draw a white rectangle of size (CropBox.width * zoom, CropBox.height * zoom) at (orgx, orgy)
representing the page (optional; Acrobat does not do that, and this method already draws the
white page background).
4. Call the IPage.Draw() method to draw the page at (orgx, orgy).
Note that extra care must be taken when filling rectangles as to whether the boundary pixel will be
inside or outside the region.
ExtractText(left, bottom, right, top)
Returns the text located inside the region bounded by the left, bottom, right and top parameters. If mul-
tiple lines are found, they are separated by a CR-LF pair.
Page 209