Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/custom page size #149

Merged
merged 5 commits into from
May 22, 2020

Conversation

sanderai
Copy link

@sanderai sanderai commented May 19, 2020

Description
Adds a new method for creating documents with custom page dimensions. Previous shorthand is preserved and uses the new method internally to avoid duplicate code.

Related Issue
resolves #148

Checklist

check with "x", if applied to your change

  • All methods associated with structs has func (s *struct) method() {} name style.
  • Wrote unit tests for new/changed features.
  • Updated docs/doc.go - docs file seems to not include all methods? didn't change this so maybe original developer can update this if necessary.
  • Updated pkg/pdf/example_test.go
  • Updated README.md - Mentioned the new method but not linked to godoc
  • Updated all examples inside internal/examples
  • New public methods/structs/interfaces has comments upside them explaining they responsibilities
  • Executed go fmt github.com/johnfercher/maroto/... to format all files

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2020

Codecov Report

Merging #149 into master will increase coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #149      +/-   ##
==========================================
+ Coverage   96.24%   96.36%   +0.12%     
==========================================
  Files           9        9              
  Lines         584      603      +19     
==========================================
+ Hits          562      581      +19     
  Misses         16       16              
  Partials        6        6              
Impacted Files Coverage Δ
pkg/pdf/pdf.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9add775...7717496. Read the comment docs.

@johnferchermeli
Copy link
Contributor

johnferchermeli commented May 22, 2020

Strange that the width and height parameters invert when set the landspace orientation. Is this correct?

@sanderai
Copy link
Author

sanderai commented May 22, 2020

Strange that the width and height parameters invert when set the landspace orientation. Is this correct?

Yeah this seems to be the way gofpdf.NewCustom() works. I think the "default" orientation is Portrait and you give the width and height of that. And then when you turn it to landscape, it flips those numbers (as seen in their source).
They also use just the portrait dimensions for defining their own preset sizes as seen here (they use the "points" unit for dimensions which is why they look odd)

So yes, this is the correct behavior as page dimensions are usually given in portrait orientation. You could theoretically use Portrait input and give a wider width than height and have a "landscape" page that way, but that would be cheating a bit.

@johnfercher johnfercher merged commit e331fbb into johnfercher:master May 22, 2020
felix pushed a commit to felix/maroto that referenced this pull request May 2, 2022
felix pushed a commit to felix/maroto that referenced this pull request May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add custom page size option when creating documents
4 participants