unidoc / unipdf

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

[FEATURE] Add more presets and initializer for PageSize #535

Open Shion1305 opened 8 months ago

Shion1305 commented 8 months ago

I suggest these 2 points. (Sorry for my poor English.)

Currently, the following preset of PageSize are available.

Also, I suggest adding an initializer for PageSize. Currently, there are no initializers available for PageSize, it is a kind of confusing figuring out how to use custom PageSize. Adding an initializer would provide library users with some level of convenience.

github-actions[bot] commented 8 months ago

Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/

sampila commented 8 months ago

Hi @shion1305,

Thanks for the suggestions, we will considering your feedback. Currently to sets the custom page size should be easy, like if you want to set the page size to US Standard: 3.5inchx2inch, you can follow this line of code below

c := creator.New()

...
pageSizeUSStrandard := creator.PageSize{3.5 * creator.PPI, 2 * creator.PPI}

c.SetPageSize(pageSizeUSStrandard)

Our API references can be seen on https://apidocs.unidoc.io/unipdf/v3.39.0

Best regards, Alip