src/img2pdf.py: the /OpenAction array must contain the page as an indirect object

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-11-28 16:55:42 +01:00
parent dc926b2cf2
commit 30d705f020
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1106,6 +1106,10 @@ class pdfdoc(object):
[initial_page, PdfName.XYZ, NullObject, NullObject, 0] [initial_page, PdfName.XYZ, NullObject, NullObject, 0]
) )
# the /OpenAction array must contain the page as an indirect object
if self.engine == Engine.pikepdf:
initial_page = self.writer.make_indirect(initial_page)
if self.magnification == Magnification.fit: if self.magnification == Magnification.fit:
catalog[PdfName.OpenAction] = PdfArray([initial_page, PdfName.Fit]) catalog[PdfName.OpenAction] = PdfArray([initial_page, PdfName.Fit])
elif self.magnification == Magnification.fith: elif self.magnification == Magnification.fith: