Skip to content
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Added "scale" option. #16

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ req.Footer(footer)
req.Assets(style, img)
req.PaperSize(gotenberg.A4)
req.Margins(gotenberg.NoMargins)
req.Scale(0.75)

// store method allows you to... store the resulting PDF in a particular destination.
client.Store(req, "path/you/want/the/pdf/to/be/stored.pdf")
Expand Down
6 changes: 6 additions & 0 deletions chrome.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (
landscapeChrome string = "landscape"
pageRanges string = "pageRanges"
googleChromeRpccBufferSize string = "googleChromeRpccBufferSize"
scale string = "scale"
)

// nolint: gochecknoglobals
Expand Down Expand Up @@ -101,3 +102,8 @@ func (req *chromeRequest) PageRanges(ranges string) {
func (req *chromeRequest) GoogleChromeRpccBufferSize(bufferSize int64) {
req.values[googleChromeRpccBufferSize] = strconv.FormatInt(bufferSize, 10)
}

// Scale sets scale form field
func (req *chromeRequest) Scale(scaleFactor float64) {
req.values[scale] = fmt.Sprintf("%f", scaleFactor)
}
1 change: 1 addition & 0 deletions html_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func TestHTMLComplete(t *testing.T) {
req.Margins(NormalMargins)
req.Landscape(false)
req.GoogleChromeRpccBufferSize(1048576)
req.Scale(1.5)
dirPath, err := test.Rand()
require.Nil(t, err)
dest := fmt.Sprintf("%s/foo.pdf", dirPath)
Expand Down