DynamicPDF Generator for Java uses a coordinate system based on points. There are 72 points in an inch and 28.35 points in a centimeter:
- 1 point = 1/72 inch = 0.353 mm
- 18 points = 1/4 inch
- 72 points = 1 inch
- 28.35 points = 1 centimeter
- 12 points = 1 pica = 1/6 inch
Each page has a width and height as well as margins. When a new Page object is created, its dimensions are specified in the constructor. You can use predefined static values from the PageSize and PageOrientation classes or specify custom values for the width and height. Once a page is created its dimensions can be modified through the page's setDimensions property.
When page elements are added to the page their coordinate properties must be set. These values are measured from the upper left margin of the page. The X properties are measured from the left margin and the Y properties are measured from the top margin.
The LayoutGrid page element can be used to display a grid on the page. This is useful when placing page elements on the page.
Note: For landscape pages simply swap the width and height. Example: For a landscape 8.5" by 11" letter document set the width to 792 and the height to 612. You can also specify the page to be landscape by setting the PageOrientation to Landscape in the Page constructor.
com.cete.dynamicpdf.Page page = new com.cete.dynamicpdf.Page( PageSize.LETTER, PageOrientation.LANDSCAPE, 54.0f );