From be8369373fbe1d75f40ada7f9f995d37ea57184c Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Sun, 16 Oct 2022 14:13:22 +0200 Subject: [PATCH] pass deterministic_id=True to writer.save() for pikepdf >= 6.2.0 Closes: #150 --- src/img2pdf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index ed5a6f3..348b843 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -1259,8 +1259,11 @@ class pdfdoc(object): # now write out the PDF if self.engine == Engine.pikepdf: + kwargs = {} + if pikepdf.__version__ >= "6.2.0": + kwargs["deterministic_id"] = True self.writer.save( - outputstream, min_version=self.output_version, linearize=True + outputstream, min_version=self.output_version, linearize=True, **kwargs ) elif self.engine == Engine.pdfrw: self.writer.trailer.Info = self.writer.docinfo