feat(pdf): add compressStreams to optimize

This commit is contained in:
Julien Neuhart
2026-11-19 12:25:04 +01:00
parent f1320d8a14
commit 351caffed7
3 changed files with 6 additions and 0 deletions

View File

@@ -475,6 +475,10 @@ func (s *optimizeStage) compaction(packObjectStreams bool) []litho.WriteOption {
opts = append(opts, litho.WithImageRecompression())
}
if boolOr(s.CompressStreams, true) {
opts = append(opts, litho.WithStreamCompression())
}
if boolOr(s.SubsetFonts, true) {
opts = append(opts, litho.WithFontSubsetting())
}

View File

@@ -735,6 +735,7 @@ type optimizeStage struct {
ObjectStreams *bool `json:"objectStreams"`
Dedup *bool `json:"dedup"`
RecompressImages *bool `json:"recompressImages"`
CompressStreams *bool `json:"compressStreams"`
SubsetFonts *bool `json:"subsetFonts"`
signatureDrop

View File

@@ -18,6 +18,7 @@ Feature: /forms/pdf/optimize
When I make a "POST" request to Gotenberg at the "/forms/pdf/optimize" endpoint with the following form data and header(s):
| files | testdata/pages_12.pdf | file |
| recompressImages | false | field |
| compressStreams | false | field |
| subsetFonts | false | field |
Then the response status code should be 200
Then the "pages_12.pdf" PDF should have 12 page(s)