Mon Jul 29 20:39:39 2019 UTC ()
py-Pdf-1.13nb3: Preserve annotations while merging pages.


(joerg)
diff -r1.7 -r1.8 pkgsrc/print/py-Pdf/Makefile
diff -r1.6 -r1.7 pkgsrc/print/py-Pdf/distinfo
diff -r1.2 -r1.3 pkgsrc/print/py-Pdf/patches/patch-pyPdf_pdf.py

cvs diff -r1.7 -r1.8 pkgsrc/print/py-Pdf/Makefile (expand / switch to unified diff)

--- pkgsrc/print/py-Pdf/Makefile 2017/01/09 12:02:23 1.7
+++ pkgsrc/print/py-Pdf/Makefile 2019/07/29 20:39:39 1.8
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1# $NetBSD: Makefile,v 1.7 2017/01/09 12:02:23 joerg Exp $ 1# $NetBSD: Makefile,v 1.8 2019/07/29 20:39:39 joerg Exp $
2 2
3DISTNAME= pyPdf-1.13 3DISTNAME= pyPdf-1.13
4PKGNAME= ${PYPKGPREFIX}-Pdf-1.13 4PKGNAME= ${PYPKGPREFIX}-Pdf-1.13
5PKGREVISION= 2 5PKGREVISION= 3
6CATEGORIES= print python 6CATEGORIES= print python
7MASTER_SITES= http://pybrary.net/pyPdf/ 7MASTER_SITES= http://pybrary.net/pyPdf/
8 8
9MAINTAINER= joerg@NetBSD.org 9MAINTAINER= joerg@NetBSD.org
10HOMEPAGE= http://pybrary.net/pyPdf/ 10HOMEPAGE= http://pybrary.net/pyPdf/
11COMMENT= PDF library 11COMMENT= PDF library
12LICENSE= modified-bsd 12LICENSE= modified-bsd
13 13
14.include "../../lang/python/distutils.mk" 14.include "../../lang/python/distutils.mk"
15.include "../../mk/bsd.pkg.mk" 15.include "../../mk/bsd.pkg.mk"

cvs diff -r1.6 -r1.7 pkgsrc/print/py-Pdf/distinfo (expand / switch to unified diff)

--- pkgsrc/print/py-Pdf/distinfo 2017/01/09 12:02:23 1.6
+++ pkgsrc/print/py-Pdf/distinfo 2019/07/29 20:39:39 1.7
@@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
1$NetBSD: distinfo,v 1.6 2017/01/09 12:02:23 joerg Exp $ 1$NetBSD: distinfo,v 1.7 2019/07/29 20:39:39 joerg Exp $
2 2
3SHA1 (pyPdf-1.13.tar.gz) = ba7aed11cf21a2c218df2e3979be5eb90992dcbe 3SHA1 (pyPdf-1.13.tar.gz) = ba7aed11cf21a2c218df2e3979be5eb90992dcbe
4RMD160 (pyPdf-1.13.tar.gz) = 0669d4a93c20fcd899d15ff42cb1b8b908f28e3b 4RMD160 (pyPdf-1.13.tar.gz) = 0669d4a93c20fcd899d15ff42cb1b8b908f28e3b
5SHA512 (pyPdf-1.13.tar.gz) = 1c00a5a6658054671a396e7b334cbeb9e26dc1e3ad9668e212d05a9483f164931d8bd14fb9ab4d083d7ca3999fee7a2e9eea55b604a06c7d5d0632f0791b7598 5SHA512 (pyPdf-1.13.tar.gz) = 1c00a5a6658054671a396e7b334cbeb9e26dc1e3ad9668e212d05a9483f164931d8bd14fb9ab4d083d7ca3999fee7a2e9eea55b604a06c7d5d0632f0791b7598
6Size (pyPdf-1.13.tar.gz) = 35699 bytes 6Size (pyPdf-1.13.tar.gz) = 35699 bytes
7SHA1 (patch-pyPdf_generic.py) = c661b2fd4cea8679ac551733ea25b7efa9fbb37d 7SHA1 (patch-pyPdf_generic.py) = c661b2fd4cea8679ac551733ea25b7efa9fbb37d
8SHA1 (patch-pyPdf_pdf.py) = 560fbb475c976fc2c0e653d8a17e4a4277ac5a06 8SHA1 (patch-pyPdf_pdf.py) = 3359ec14fb25fedc86d27d23c052d1891c8c9e4d
9SHA1 (patch-pyPdf_utils.py) = 11b14d0c3bdbdac04312f1a4f8eb9f27c6d09009 9SHA1 (patch-pyPdf_utils.py) = 11b14d0c3bdbdac04312f1a4f8eb9f27c6d09009

cvs diff -r1.2 -r1.3 pkgsrc/print/py-Pdf/patches/patch-pyPdf_pdf.py (expand / switch to unified diff)

--- pkgsrc/print/py-Pdf/patches/patch-pyPdf_pdf.py 2017/01/09 12:02:23 1.2
+++ pkgsrc/print/py-Pdf/patches/patch-pyPdf_pdf.py 2019/07/29 20:39:39 1.3
@@ -1,17 +1,18 @@ @@ -1,17 +1,18 @@
1$NetBSD: patch-pyPdf_pdf.py,v 1.2 2017/01/09 12:02:23 joerg Exp $ 1$NetBSD: patch-pyPdf_pdf.py,v 1.3 2019/07/29 20:39:39 joerg Exp $
2 2
3python-3.x compatibility. 3python-3.x compatibility.
4When renaming resources, make sure that the new name is actually new. 4When renaming resources, make sure that the new name is actually new.
 5Preserve annotations on page merge.
5 6
6--- pyPdf/pdf.py.orig 2010-12-04 22:49:56.000000000 +0000 7--- pyPdf/pdf.py.orig 2010-12-04 22:49:56.000000000 +0000
7+++ pyPdf/pdf.py 8+++ pyPdf/pdf.py
8@@ -652,7 +652,7 @@ class PdfFileReader(object): 9@@ -652,7 +652,7 @@ class PdfFileReader(object):
9 if not self._override_encryption and self.isEncrypted: 10 if not self._override_encryption and self.isEncrypted:
10 # if we don't have the encryption key: 11 # if we don't have the encryption key:
11 if not hasattr(self, '_decryption_key'): 12 if not hasattr(self, '_decryption_key'):
12- raise Exception, "file has not been decrypted" 13- raise Exception, "file has not been decrypted"
13+ raise Exception("file has not been decrypted") 14+ raise Exception("file has not been decrypted")
14 # otherwise, decrypt here... 15 # otherwise, decrypt here...
15 import struct 16 import struct
16 pack1 = struct.pack("<i", indirectReference.idnum)[:3] 17 pack1 = struct.pack("<i", indirectReference.idnum)[:3]
17@@ -704,14 +704,14 @@ class PdfFileReader(object): 18@@ -704,14 +704,14 @@ class PdfFileReader(object):
@@ -57,13 +58,22 @@ When renaming resources, make sure that  @@ -57,13 +58,22 @@ When renaming resources, make sure that
57 for key in page2Res.keys(): 58 for key in page2Res.keys():
58 if newRes.has_key(key) and newRes[key] != page2Res[key]: 59 if newRes.has_key(key) and newRes[key] != page2Res[key]:
59- newname = NameObject(key + "renamed") 60- newname = NameObject(key + "renamed")
60+ base_newkey = key + "renamed" 61+ base_newkey = key + "renamed"
61+ newkey = base_newkey 62+ newkey = base_newkey
62+ counter = 0 63+ counter = 0
63+ while newRes.has_key(newkey) or page2Res.has_key(newkey): 64+ while newRes.has_key(newkey) or page2Res.has_key(newkey):
64+ newkey = "%s%d" % (base_newkey, counter) 65+ newkey = "%s%d" % (base_newkey, counter)
65+ counter = counter + 1 66+ counter = counter + 1
66+ newname = NameObject(newkey) 67+ newname = NameObject(newkey)
67 renameRes[key] = newname 68 renameRes[key] = newname
68 newRes[newname] = page2Res[key] 69 newRes[newname] = page2Res[key]
69 elif not newRes.has_key(key): 70 elif not newRes.has_key(key):
 71@@ -1149,7 +1155,7 @@ class PageObject(DictionaryObject):
 72 originalResources = self["/Resources"].getObject()
 73 page2Resources = page2["/Resources"].getObject()
 74
 75- for res in "/ExtGState", "/Font", "/XObject", "/ColorSpace", "/Pattern", "/Shading", "/Properties":
 76+ for res in "/ExtGState", "/Font", "/XObject", "/ColorSpace", "/Pattern", "/Shading", "/Properties", "/Annots":
 77 new, newrename = PageObject._mergeResources(originalResources, page2Resources, res)
 78 if new:
 79 newResources[NameObject(res)] = new