Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the 'margin' attribute of Document in iText PDF for?

Tags:

java

itext

What is margin attribute of Document e.g

Document(new Rectangle(PageSize.A4),8,2,75,0);  

in which 8 means top margin in mm cm or pixel.

like image 694
Jay Rami Avatar asked Oct 23 '25 14:10

Jay Rami


1 Answers

PDF uses the user unit as measurement unit. One user unit roughly corresponds with a typographic point (1/72 of an inch).

The default user unit can be changed if a /UserUnit key is present. The default value (if the key is absent) is 1.0. In this case, 1 user unit equals i.e. 1/72 of an inch.

According to the Adobe Portable Document Format Reference version 1.7, p. 148, a UserUnit is defined as:

A positive number giving the size of default user space units, in multiples of 1/72 inch. The range of supported values is implementation-dependent; see implementation note 177 in Appendix H. Default value: 1.0 (user unit is 1/72 inch).

So the value 8 means 8 points, i.e. 8/72 inches.

It is also good to note that (from p. 201):

The default for the size of the unit in default user space (1/72 inch) is approximately the same as a point, a unit widely used in the printing industry. It is not exactly the same, however; there is no universal definition of a point.

like image 144
Jia Jian Goi Avatar answered Oct 25 '25 02:10

Jia Jian Goi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!