unipdf icon indicating copy to clipboard operation
unipdf copied to clipboard

[FEATURE] Add more presets and initializer for PageSize

Open Shion1305 opened this issue 2 years ago • 2 comments

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

  • Adding more presets for PageSize
  • Adding Initializer for PageSize, like NewPageSizeMM(width int, height int)

Currently, the following preset of PageSize are available.

  • PageSizeA5
  • PageSizeA4
  • PageSizeA3
  • PageSizeLegal
  • PageSizeLetter Adding more presets would be useful for users like me. I suggest adding the following presets.
  • ISO/JIS B5, B4,B3
  • Business Card Sizes (JIS: 91mmx55mm, US Standard: 3.5inchx2inch)

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.

Shion1305 avatar Nov 01 '23 16:11 Shion1305

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/

github-actions[bot] avatar Nov 01 '23 16:11 github-actions[bot]

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

sampila avatar Nov 01 '23 17:11 sampila