diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-04-10 05:36:05 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-04-10 05:36:05 +0100 |
commit | 4bbcd26e7cb1908fb98bb318bfaa13ea9e32d860 (patch) | |
tree | 39e9258a61ef296b0e5afba0c7dc2557891487c4 /app-text/krop/files/krop-0.6.0-links.patch | |
parent | 47d5e233005d470dbd431a280e64ce6073fc7149 (diff) |
gentoo auto-resync : 10:04:2023 - 05:36:05
Diffstat (limited to 'app-text/krop/files/krop-0.6.0-links.patch')
-rw-r--r-- | app-text/krop/files/krop-0.6.0-links.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/app-text/krop/files/krop-0.6.0-links.patch b/app-text/krop/files/krop-0.6.0-links.patch new file mode 100644 index 000000000000..c311b10cf88e --- /dev/null +++ b/app-text/krop/files/krop-0.6.0-links.patch @@ -0,0 +1,64 @@ +From a39f8328cf59492e68643f499c0d0fbda910444c Mon Sep 17 00:00:00 2001 +From: Armin Straub <31167361+arminstraub@users.noreply.github.com> +Date: Sun, 17 Jan 2021 15:50:49 -0600 +Subject: [PATCH] Preserve links within a PDF (thanks to chrthi) + +--- + ChangeLog | 4 ++++ + krop/mainwindow.py | 1 + + krop/pdfcropper.py | 11 +++++++++++ + 3 files changed, 16 insertions(+) + +diff --git a/ChangeLog b/ChangeLog +index eb7dbb1..4ffbedb 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,7 @@ ++krop (0.6.1) 2021-00-00 -- Armin Straub ++ ++ * Preserve links within a PDF (thanks to chrthi for doing this). ++ + krop (0.6.0) 2020-06-09 -- Armin Straub + + + Fixed aspect ratios, like letter size, can be chosen for selections. +diff --git a/krop/mainwindow.py b/krop/mainwindow.py +index fd1ae32..e8adadf 100644 +--- a/krop/mainwindow.py ++++ b/krop/mainwindow.py +@@ -413,6 +413,7 @@ def slotKrop(self): + pdf = PdfFile() + pdf.loadFromFile(inputFileName) + cropper = PdfCropper() ++ cropper.copyDocumentRoot(pdf) + for nr in pages: + c = self.viewer.cropValues(nr) + cropper.addPageCropped(pdf, nr, c, alwaysinclude, rotation) +diff --git a/krop/pdfcropper.py b/krop/pdfcropper.py +index 679c6fc..db30646 100644 +--- a/krop/pdfcropper.py ++++ b/krop/pdfcropper.py +@@ -55,6 +55,8 @@ def writeToFile(self, filename): + stream.close() + def addPageCropped(self, pdffile, pagenumber, croplist, rotate=0): + pass ++ def copyDocumentRoot(self, pdffile): ++ pass + + + class PyPdfFile(AbstractPdfFile): +@@ -110,6 +112,15 @@ def cropPage(self, page, crop, rotate): + if rotate != 0: + page.rotateClockwise(rotate) + ++ def copyDocumentRoot(self, pdffile): ++ # Sounds promising in PyPDF2 (see PdfFileWriter.cloneDocumentFromReader), ++ # but doesn't seem to produce a readable PDF: ++ # self.output.cloneReaderDocumentRoot(pdffile.reader) ++ # Instead, this copies at least the named destinations for links: ++ for dest in pdffile.reader.namedDestinations.values(): ++ self.output.addNamedDestinationObject(dest) ++ ++ + def optimizePdfGhostscript(oldfilename, newfilename): + import subprocess + subprocess.check_call(('gs', '-sDEVICE=pdfwrite', '-sOutputFile=' + newfilename, |