Skip to content

Commit 08c3390

Browse files
committed
Compress new streams on output
1 parent 210be8d commit 08c3390

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ func convertToOptimizedPDF(in string, out string) error {
556556
}
557557
q.SetObjectStreamMode(qpdf.ObjectStreamGenerate)
558558
q.SetStreamDataMode(qpdf.StreamDataPreserve)
559+
q.SetCompressStreams(true)
559560
if err := q.Write(); err != nil {
560561
return err
561562
}

qpdf/qpdf.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ func (q *QPDF) SetQDFMode(v bool) {
8484
C.qpdf_set_qdf_mode(q.data, qv)
8585
}
8686

87+
func (q *QPDF) SetCompressStreams(v bool) {
88+
if q.closed {
89+
return
90+
}
91+
var qv C.QPDF_BOOL = C.QPDF_FALSE
92+
if v {
93+
qv = C.QPDF_TRUE
94+
}
95+
C.qpdf_set_compress_streams(q.data, qv)
96+
}
97+
8798
func (q *QPDF) SetSuppressWarnings(v bool) {
8899
if q.closed {
89100
return

0 commit comments

Comments
 (0)