Skip to content

Commit

Permalink
Fix orientation when page size is set up (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hintay authored Nov 6, 2023
1 parent 1249492 commit 7493f4c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/config/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type builder struct {
pageNumberPlace props.Place
protection *entity.Protection
compression bool
pageSize *pagesize.Type
orientation orientation.Type
metadata *entity.Metadata
backgroundImage *entity.Image
Expand Down Expand Up @@ -83,12 +84,7 @@ func (b *builder) WithPageSize(size pagesize.Type) Builder {
return b
}

width, height := pagesize.GetDimensions(size)
b.dimensions = &entity.Dimensions{
Width: width,
Height: height,
}

b.pageSize = &size
return b
}

Expand Down Expand Up @@ -311,7 +307,12 @@ func (b *builder) getDimensions() *entity.Dimensions {
return b.dimensions
}

width, height := pagesize.GetDimensions(pagesize.A4)
pageSize := pagesize.A4
if b.pageSize != nil {
pageSize = *b.pageSize
}

width, height := pagesize.GetDimensions(pageSize)
dimensions := &entity.Dimensions{
Width: width,
Height: height,
Expand Down

0 comments on commit 7493f4c

Please sign in to comment.