danfickle / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!
https://danfickle.github.io/pdf-templates/index.html
Other
1.93k stars 360 forks source link

How to change page orientation? #934

Closed boonyachengdu closed 1 year ago

boonyachengdu commented 1 year ago

A4 page change orientation by using @page { A4 landscape; } dose not work. Has any Java API can do this? I used following code:

 builder.useDefaultPageSize(297,210, Java2DRendererBuilder.PageSizeUnits.MM);

insted of

builder.useDefaultPageSize(210,297, Java2DRendererBuilder.PageSizeUnits.MM);

it works !!!!