unidoc / unipdf

Golang PDF library for creating and processing PDF files (pure go)
https://unidoc.io
Other
2.5k stars 249 forks source link

[FEATURE] Page orientation #399

Closed mchusovlianov closed 3 years ago

mchusovlianov commented 3 years ago

Hey, guys!

Does this library have a way to set page orientation (portrait/landscape)? So far I found only the rotation option but that isn't actually the same like the landscape orientation.

3ace commented 3 years ago

for an example of creating a landscape PDF document, you can take a look at this code example

https://github.com/unidoc/unipdf-examples/blob/master/report/pdf_report_landscape.go

basically what you need to do is set the page size accordingly

// Switch the page size constant from the available predefined size for a landscape page
c.SetPageSize(creator.PageSize{creator.PageSizeA4[1], creator.PageSizeA4[0]})