The only restriction is that the Crop Box is always inside the Media Box. These two boxes are often exactly the same, but they can of course be different sizes, and they can also be different rotations. The Crop box is what the user sees on the computer screen. As explained earlier, the Media Box is meant to represent what the user would see if they printed out the PDF page. The two most important boxes for scripting, and handling page geometry in general, are the Media Box and the Crop Box. These empty areas are usually the result of an inefficient or in some cases a down right poor PDF creation process. PDF content often includes invisible boundaries that extend beyond the visible elements.
Ideally, a line drawn around the BBox would touch the edges of the visible content on all four sides of the page. This box is calculated by Acrobat and so it cannot be modified by a script. The BBox, or the Bounding Box, is the smallest rectangle that can enclose all the content on the page. They represent important stages in the printing of a document, but are invisible to the average user and unimportant for our purposes here, so they won't be discussed. The next 3 boxes, Art, Bleed, and Trim, have special meaning to printers. But it is still very important to page geometry, as will be explained below. The Media Box doesn't have quite the same importance for an interactive document displayed on the screen. And all the other bounding boxes are inside this one. Originally this meant the paper size the page was to be printed on. Horizontal, or X, coordinates increase to the rights and vertical, or Y, coordinates increase towards the top (Figure 1)įigure 2 - The different Page Boxes that define a page's boundaries. The origin, or 0,0 point is located in the bottom left hand corner of the page. The units of User Space are called "points" and there are 72 points/inch. And in fact that's a good way to think about it. This is a flat 2- dimensional space, just like a piece of paper. The coordinate system on a PDF page is called User Space. Automation tools that demonstrate page geometry operations.Swat the Fly Game (Variation on Bouncing Button).2D Matrix Mulitplier (Discussed in Converting Coordinates).Sample Files that demonstrate page geometry operations.Finding Words, and Handling Word Locations.And is also very useful for form scripting. So understanding page coordinates is critical to many common automation activities. Page coordinates are used to add fields and annotations to a page, move fields and annotations, resize page boundaries, locate words on a page, and for any other operation that involves page geometry.