Package Details: pdfposter-git 0.8.1.r27.g2d0ed65-1

Git Clone URL: https://aur.archlinux.org/pdfposter-git.git (read-only, click to copy)
Package Base: pdfposter-git
Description: Print large posters on multiple sheets
Upstream URL: https://pdfposter.readthedocs.io
Licenses: GPL3
Submitter: mschu
Maintainer: mschu
Last Packager: mschu
Votes: 3
Popularity: 0.000000
First Submitted: 2016-06-20 21:31 (UTC)
Last Updated: 2023-11-14 18:17 (UTC)

Dependencies (2)

Required by (0)

Sources (1)

Latest Comments

pzl commented on 2023-05-25 20:29 (UTC)

since commit 90981518, the folder structure changed so the patch file needs the path updating. Just removing pdftools/ should do it

ElijahLynn commented on 2021-01-09 01:04 (UTC)

Thanks ulidtko, pasting your direct link to patch here from https://gitlab.com/pdftools/pdfposter/-/issues/1#note_439488873 > https://gitlab.com/pdftools/pdfposter/uploads/3b2acd56b660f318fe185688a504592c/overlap.rebased-0ec90f038d2d10f8f20259335a9df98bf9ecaefe.patch

ulidtko commented on 2020-11-01 00:02 (UTC)

Hi!

The upstream author has broken the overlap.patch again with a few post-release commits in master. This is a rebased patch, please update.

diff --git i/pdftools/pdfposter/__init__.py w/pdftools/pdfposter/__init__.py
index 07e2cbe..a5f5e5c 100755
--- i/pdftools/pdfposter/__init__.py
+++ w/pdftools/pdfposter/__init__.py
@@ -33,6 +33,7 @@ from logging import log
 import math

 DEFAULT_MEDIASIZE = 'a4'
+DEFAULT_OVERLAP_PERCENT = 0

 mm = 72 / 25.4

@@ -141,17 +142,17 @@ def rotate2portrait(box, which):
         log(18, 'Rotating %s specs to portrait format', which)
         return True

-def decide_num_pages(inbox, mediabox, posterbox, scale=None):
+def decide_num_pages(inbox, mediabox, posterbox, scale=None, overlap=0.01*DEFAULT_OVERLAP_PERCENT):
     """decide on number of pages"""
     # avoid changing original posterbox when handling multiple pages
     # (if --scale, posterbox is None)
     posterbox = posterbox and posterbox.copy()
-    cutmargin   = {'x': 0, 'y': 0} # todo
     whitemargin = {'x': 0, 'y': 0} # todo
     # media and image sizes (inbox) are fixed already
     # available drawing area per sheet
-    drawable_x = mediabox['width' ] - 2*cutmargin['x']
-    drawable_y = mediabox['height'] - 2*cutmargin['y']
+    drawable_x = mediabox['width' ] * (1-2*overlap)
+    drawable_y = mediabox['height'] * (1-2*overlap)
+    log(17, 'drawable dimensions: %.2f %.2f (calculated)', drawable_x, drawable_y)

     rotate = False

@@ -259,12 +260,13 @@ def _scale_pdf_page(outpdf, page, factor):
     page[NameObject('/Contents')] = outpdf._addObject(content)


-def posterize(outpdf, page, mediabox, posterbox, scale, use_ArtBox=False):
+def posterize(outpdf, page, mediabox, posterbox, scale, use_ArtBox=False, overlap=0.01*DEFAULT_OVERLAP_PERCENT):
     """
     page: input page
     mediabox : size secs of the media to print on
     posterbox: size secs of the resulting poster
     scale: scale factor (to be used instead of posterbox)
+    overlap: proportion of expected overlap per output page
     """
     if use_ArtBox:
         inbox = rectangle2box(page.artBox)
@@ -273,7 +275,7 @@ def posterize(outpdf, page, mediabox, posterbox, scale, use_ArtBox=False):
     _clip_pdf_page(page, inbox['offset_x'], inbox['offset_y'],
                    inbox['width'], inbox['height'])
     ncols, nrows, scale, rotate = decide_num_pages(inbox, mediabox,
-                                                   posterbox, scale)
+                                                   posterbox, scale, overlap)
     mediabox = mediabox.copy()
     _scale_pdf_page(outpdf, page, scale)
     if rotate:
@@ -291,7 +293,7 @@ def posterize(outpdf, page, mediabox, posterbox, scale, use_ArtBox=False):
     h_pos = float(trimbox['offset_x'])
     h_max, v_max = float(trimbox['width']), float(trimbox['height'])
     for col in range(ncols):
-        v_pos = float(trimbox['offset_y']) + (nrows-1) * v_step
+        v_pos = float(trimbox['offset_y']) + (nrows-1) * v_step * (1-2*overlap)
         for row in range(nrows):
             log(17, 'Creating page with offset: %.2f %.2f' % (h_pos, v_pos))
             newpage = copyPage(page)
@@ -306,8 +308,8 @@ def posterize(outpdf, page, mediabox, posterbox, scale, use_ArtBox=False):
                                                min(v_max, v_pos + v_step)))
             newpage.artBox = newpage.trimBox
             outpdf.addPage(newpage)
-            v_pos -= v_step
-        h_pos += h_step
+            v_pos -= v_step*(1-2*overlap)
+        h_pos += h_step*(1-2*overlap)

 def password_hook():
     import getpass
@@ -344,7 +346,7 @@ def main(opts, infilename, outfilename, password_hook=password_hook):
         page = inpdf.getPage(i)
         log(19, '---- processing page %i -----', i+1)
         posterize(outpdf, page, opts.media_size, opts.poster_size, opts.scale,
-                  opts.use_ArtBox)
+                  opts.use_ArtBox, opts.overlap_percent/100.0)

     if not opts.dry_run:
         outpdf.write(open(outfilename, 'wb'))
diff --git i/pdftools/pdfposter/cmd.py w/pdftools/pdfposter/cmd.py
index fa5b693..38872d3 100644
--- i/pdftools/pdfposter/cmd.py
+++ w/pdftools/pdfposter/cmd.py
@@ -25,7 +25,7 @@ __author__ = "Hartmut Goebel <h.goebel@crazy-compilers.com>"
 __copyright__ = "Copyright 2008-2018 by Hartmut Goebel <h.goebel@crazy-compilers.com>"
 __licence__ = "GNU General Public License version 3 (GPL v3)"

-from . import main, __version__, DEFAULT_MEDIASIZE, papersizes, DecryptionError
+from . import main, __version__, DEFAULT_OVERLAP_PERCENT, DEFAULT_MEDIASIZE, papersizes, DecryptionError
 import re
 import PyPDF2.utils
 import argparse
@@ -171,6 +171,8 @@ def run(args=None):
                        'of the input image size. Thus, a scaling factor of 2 '
                        'results in a poster 4 times the area compared to the '
                        'original.')
+    group.add_argument('-O', '--overlap-percent', type=float, default = DEFAULT_OVERLAP_PERCENT,
+                     help='Image overlap (default: %g).' % DEFAULT_OVERLAP_PERCENT)

     parser.add_argument('infilename', metavar='InputFile')
     parser.add_argument('outfilename', metavar='OutputFile')

Sunday commented on 2017-05-29 13:43 (UTC)

The included overlap.patch does not work. It tries to "group.add_option", but commit f5790c751dea7c0419f61ddc5d22246ac90c329a switched from OptionParser to ArgumentParser and it should be "group.add_argument".