2

I am using itext PDF, and I need to set PDF document size as German Std. Fanfold(8 1/2" x 12"),I don't know how set Inches In Itext document.

// Now I can set paper size as A4 but i need to set 8 1/2" x 12" or German Std. Fanfold size 
document(name: fileName,pageSize: PageSize.A4,leftMargin:8, rightMargin:8, topMargin:8, bottomMargin:3)

Thanks in advance.

Kamal kannan
  • 253
  • 3
  • 17

1 Answers1

12

Please do yourself a favor and read the documentation!

As explained in the Getting started section, measurements are expressed in user units, and there are 72 user units in an inch, so:

8.5 inch x 72 points = 612 user units
12 inch x 72 points = 864 user units

So you need to create a rectangle like this:

Rectangle pagesize = new Rectangle(612, 864);

and a document like this:

Document document = new Document(pagesize);

edited 1/25/2021

Wellspring
  • 1,128
  • 1
  • 10
  • 19
Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165