pdftools.pdfposter-0.7.post1/ 0000755 0001750 0001750 00000000000 13316677212 017466 5 ustar hartmut hartmut 0000000 0000000 pdftools.pdfposter-0.7.post1/PKG-INFO 0000644 0001750 0001750 00000003700 13316677212 020563 0 ustar hartmut hartmut 0000000 0000000 Metadata-Version: 1.1
Name: pdftools.pdfposter
Version: 0.7.post1
Summary: Scale and tile PDF images/pages to print on multiple pages.
Home-page: https://pdfposter.readthedocs.io/
Author: Hartmut Goebel
Author-email: h.goebel@crazy-compilers.com
License: GPL 3.0
Download-URL: https://pypi.org/project/pdftools.pdfposter/
Description-Content-Type: UNKNOWN
Description:
``Pdfposter`` can be used to create a large poster by building it from
multiple pages and/or printing it on large media. It expects as input a
PDF file, normally printing on a single page. The output is again a
PDF file, maybe containing multiple pages together building the
poster.
The input page will be scaled to obtain the desired size.
This is much like ``poster`` does for Postscript files, but working
with PDF. Since sometimes poster does not like your files converted
from PDF. :-) Indeed ``pdfposter`` was inspired by ``poster``.
For more information please refere to the manpage or visit
the `project homepage `_.
Keywords: pdf poster
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Printing
Classifier: Topic :: Utilities
pdftools.pdfposter-0.7.post1/setup.py 0000644 0001750 0001750 00000010606 13316677212 021203 0 ustar hartmut hartmut 0000000 0000000 """
``Pdfposter`` can be used to create a large poster by building it from
multiple pages and/or printing it on large media. It expects as input a
PDF file, normally printing on a single page. The output is again a
PDF file, maybe containing multiple pages together building the
poster.
The input page will be scaled to obtain the desired size.
This is much like ``poster`` does for Postscript files, but working
with PDF. Since sometimes poster does not like your files converted
from PDF. :-) Indeed ``pdfposter`` was inspired by ``poster``.
For more information please refere to the manpage or visit
the `project homepage `_.
"""
from setuptools import setup, find_packages
from distutils.core import Command
from distutils import log
import os, sys
class build_docs(Command):
description = "build documentation from rst-files"
user_options=[]
def initialize_options (self): pass
def finalize_options (self):
self.docpages = DOCPAGES
def run(self):
substitutions = ('.. |VERSION| replace:: '
+ self.distribution.get_version())
for writer, rstfilename, outfilename in self.docpages:
distutils.dir_util.mkpath(os.path.dirname(outfilename))
log.info("creating %s page %s", writer, outfilename)
if not self.dry_run:
try:
with open(rstfilename, "rb") as fh:
rsttext = fh.read().decode('utf-8')
except IOError as e:
sys.exit(e)
rsttext = '\n'.join((substitutions, '', rsttext))
# docutils.core does not offer easy reading from a
# string into a file, so we need to do it ourself :-(
doc = docutils.core.publish_string(source=rsttext,
source_path=rstfilename,
writer_name=writer)
try:
with open(outfilename, 'wb') as fh:
fh.write(doc) # is already encoded
except IOError as e:
sys.exit(e)
cmdclass = {}
try:
import docutils.core
import docutils.io
import docutils.writers.manpage
import distutils.command.build
distutils.command.build.build.sub_commands.append(('build_docs', None))
cmdclass['build_docs'] = build_docs
except ImportError:
log.warn("docutils not installed, can not build man pages. "
"Using pre-build ones.")
DOCPAGES = (
('manpage', 'pdfposter.rst', 'docs/pdfposter.1'),
('html', 'pdfposter.rst', 'docs/pdfposter.html'),
)
setup(
cmdclass=cmdclass,
name = "pdftools.pdfposter",
version='0.7.post1',
install_requires = ['PyPDF2'],
packages=['pdftools.pdfposter'],
namespace_packages=['pdftools'],
package_data = {
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
'hello': ['*.msg'],
},
# metadata for upload to PyPI
author = "Hartmut Goebel",
author_email = "h.goebel@crazy-compilers.com",
description = "Scale and tile PDF images/pages to print on multiple pages.",
long_description = __doc__,
license = "GPL 3.0",
keywords = "pdf poster",
url = "https://pdfposter.readthedocs.io/",
download_url = "https://pypi.org/project/pdftools.pdfposter/",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Printing',
'Topic :: Utilities',
],
# these are for easy_install (used by bdist_*)
zip_safe = True,
entry_points = {
"console_scripts": [
"pdfposter = pdftools.pdfposter.cmd:run",
],
},
)
pdftools.pdfposter-0.7.post1/setup.cfg 0000644 0001750 0001750 00000000365 13316677212 021313 0 ustar hartmut hartmut 0000000 0000000 [sdist]
formats = gztar
[bdist_wheel]
universal = 1
[zest.releaser]
history-file = CHANGES
push-changes = no
tag-format = v{version}
tag-message = pdfposter {version}
tag-signing = yes
create-wheel = yes
[egg_info]
tag_build =
tag_date = 0
pdftools.pdfposter-0.7.post1/pdfposter.rst 0000644 0001750 0001750 00000002255 13316677212 022232 0 ustar hartmut hartmut 0000000 0000000 ==========================
pdfposter
==========================
-------------------------------------------------------------
Scale and tile PDF images/pages to print on multiple pages.
-------------------------------------------------------------
:Author: Hartmut Goebel
:Version: Version |VERSION|
:Copyright: 2008-2018 by Hartmut Goebel
:Licence: GNU Public Licence v3 (GPLv3)
:Manual section: 1
.. raw:: manpage
.\" disable justification (adjust text to left margin only)
.ad l
SYNOPSIS
==========
``pdfposter`` infile outfile
DESCRIPTION
============
.. include:: docs/_description.txt
OPTIONS
========
.. include:: docs/_options.txt
.. include:: docs/_box-definitions.txt
EXAMPLES
============
.. include:: docs/_examples1.txt
More examples including sample pictures can be found at
https://pdfposter.readthedocs.io/en/latest/Examples.html
.. include:: docs/_examples2.txt
SEE ALSO
=============
``poster``\(1),
``pdfnup``\(1) https://pypi.org/project/pdfnup/,
``pdfsplit``\(1) https://pypi.org/project/pdfsplit/,
``pdfgrid``\(1) https://pypi.org/project/pdfgrid/
Project Homepage https://pdfposter.readthedocs.io/
pdftools.pdfposter-0.7.post1/README.txt 0000644 0001750 0001750 00000003027 13316677212 021166 0 ustar hartmut hartmut 0000000 0000000 ==========================
pdfposter
==========================
-------------------------------------------------------------
Scale and tile PDF images/pages to print on multiple pages.
-------------------------------------------------------------
:Author: Hartmut Goebel
:Version: Version 0.7.post1
:Copyright: 2008-2018 by Hartmut Goebel
:Licence: GNU Public Licence v3 (GPLv3)
:Homepage: https://pdfposter.readthedocs.io/
``Pdfposter`` can be used to create a large poster by building it from
multiple pages and/or printing it on large media. It expects as input a
PDF file, normally printing on a single page. The output is again a
PDF file, maybe containing multiple pages together building the
poster.
The input page will be scaled to obtain the desired size.
This is much like ``poster`` does for Postscript files, but working
with PDF. Since sometimes poster does not like your files converted
from PDF. :-) Indeed ``pdfposter`` was inspired by ``poster``.
For more information please refer to the manpage or visit
the `project homepage `_.
Requirements and Installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``Pdfposter`` requires
* `Python`__ (tested 2.7 and 3.4—3.6, but newer versions should work, too),
* `setuptools`__ or `pip`__ for installation, and
* `PyPDF2`__.
__ https://www.python.org/download/
__ https://pypi.org/project/setuptools
__ https://pypi.org/project/pip
__ http://mstamy2.github.io/PyPDF2/
.. Emacs config:
Local Variables:
mode: rst
End:
pdftools.pdfposter-0.7.post1/MANIFEST.in 0000644 0001750 0001750 00000000320 13316677212 021217 0 ustar hartmut hartmut 0000000 0000000 graft docs
prune docs/_build
include COPYING
include README.txt
include pdfposter.rst
exclude projectlogo.*
exclude .gitignore .gitattributes
global-exclude SConstruct SConscript
global-exclude *~ .\#* \#*\#
pdftools.pdfposter-0.7.post1/pdftools/ 0000755 0001750 0001750 00000000000 13316677212 021320 5 ustar hartmut hartmut 0000000 0000000 pdftools.pdfposter-0.7.post1/pdftools/pdfposter/ 0000755 0001750 0001750 00000000000 13316677212 023326 5 ustar hartmut hartmut 0000000 0000000 pdftools.pdfposter-0.7.post1/pdftools/pdfposter/cmd.py 0000644 0001750 0001750 00000017466 13316677212 024461 0 ustar hartmut hartmut 0000000 0000000 #!/usr/bin/env python
"""
pdftools.pdfposter.cmd - scale and tile PDF images/pages to print on multiple pages.
"""
#
# Copyright 2008-2018 by Hartmut Goebel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
from __future__ import print_function
__author__ = "Hartmut Goebel "
__copyright__ = "Copyright 2008-2018 by Hartmut Goebel "
__licence__ = "GNU General Public License version 3 (GPL v3)"
from . import main, __version__, DEFAULT_MEDIASIZE, papersizes, DecryptionError
import re
import PyPDF2.utils
import argparse
# pattern for parsing user textual box spec
pat_box = re.compile(r'''
( (?P (\d*\.)? \d+) x # width "x" height
(?P (\d*\.)? \d+) )?
(?P \+ # "+" offset_x "," offset_y
(?P \d+\.? | \d*\.\d+)
,
(?P \d+\.? | \d*\.\d+) ) ?
(?P [a-z][a-z0-9\-\\_]*) # unit
''', re.X+re.I)
def __parse_box(value, allow_offset=False):
m = pat_box.match(value)
if not m:
raise argparse.ArgumentTypeError("I don't understand your box specification %r" % value)
res = m.groupdict()
if not allow_offset and res['offset'] is not None:
raise argparse.ArgumentTypeError('Offset not allowed in box definition')
# res['offset'] is only used for error checking, remove it
del res['offset']
# get meassures of unit
unit = res['unit'].lower()
if not unit in papersizes:
unit = [name for name in papersizes.keys()
if name.startswith(unit)]
if len(unit) == 0:
raise argparse.ArgumentTypeError("I don't understand your papersize name %r" % res['unit'])
elif len(unit) != 1:
raise argparse.ArgumentTypeError('Your papersize name %r is not unique, give more chars.' % res['unit'])
unit = unit[0]
unit_x, unit_y = papersizes[unit]
res2 = {
'width' : float(res['width'] or 1) * unit_x,
'height' : float(res['height'] or 1) * unit_y,
'offset_x': float(res['offset_x'] or 0) * unit_x,
'offset_y': float(res['offset_y'] or 0) * unit_y,
'unit': unit,
'units_x': float(res['width'] or 1),
'units_y': float(res['height'] or 1),
}
return res2
BoxDefinitionsHelp = """\
A `BOX` to be passed to `--media-size` and `--poster-size` is a specification
of horizontal and vertical size. The syntax is as follows (with multiplier
being specified optionally):
*box* = [ *multiplier* ] *unit*
*multiplier* = *number* "x" *number*
*unit* = *medianame* or *distancename*
Please see `--help-media-size` for a list of media and distance names
supported.
Medias are typically not quadratic but rectangular, which means width
and height differ. Thus using medianames is a bit tricky:
:10x20cm: obvious: 10 cm x 20 cm (portrait)
:20x10cm: same as 10x20cm, since all boxes are rotated to portrait
format
Now when using media names it gets tricky:
:1x1a4: same as approx. 21x29cm (21 cm x 29 cm, portrait)
:1x2a4: same as approx. 21x58cm (21 cm x 58 cm, portrait)
This are two a4 pages put together at the *small* side: One
portrait page wide and two portrait pages high.
:2x1a4: same as approx. 42x29cm, which is rotated to portrait and is
(approx.) the same as 29x42cm (29 cm x 42 cm)
This are two a4 pages put together at the *long* side: Two
portrait pages wide and one portrait page high.
"""
class HelpMediaNames(argparse.Action):
def __call__(*args, **kw):
import textwrap
print('Available media and distance names:')
names = list(papersizes.keys())
names.sort()
for l in textwrap.wrap(' '.join(names), width=65):
print(' ', l)
raise SystemExit(0)
class HelpBoxDefinitions(argparse.Action):
def __call__(*args, **kw):
import textwrap
print(textwrap.dedent(BoxDefinitionsHelp))
raise SystemExit(0)
def run(args=None):
parser = argparse.ArgumentParser()
parser.add_argument('--help-media-names', action=HelpMediaNames,
nargs=0,
help='List available media and distance names')
parser.add_argument('--help-box-definitions', action=HelpBoxDefinitions,
nargs=0,
help='Show help about specifying BOX for '
'`--media-size` and `--poster-size` and exit')
parser.add_argument('--version', action='version',
version="%(prog)s " + __version__)
parser.add_argument('-v', '--verbose', action='count', default=0,
help='Be verbose. Tell about scaling, rotation and number of pages. Can be used more than once to increase the verbosity. ')
parser.add_argument('-n', '--dry-run', action='store_true',
help='Show what would have been done, but do not generate files.')
group = parser.add_argument_group('Define Input')
group.add_argument('-f', '--first', type=int, dest='first_page',
metavar='INTEGER',
help='First page to convert (default: first page)')
group.add_argument('-l', '--last', type=int, dest='last_page',
metavar='INTEGER',
help='Last page to convert (default: last page)')
group.add_argument('-A', '--art-box',
action='store_true', dest='use_ArtBox',
help='Use the content area defined by the ArtBox '
'(default: use the area defined by the TrimBox)')
group = parser.add_argument_group('Define Target')
group.add_argument('-m', '--media-size',
default=__parse_box(DEFAULT_MEDIASIZE),
type=__parse_box, metavar="BOX",
help='Specify the page size of the output media (default: %s)' % DEFAULT_MEDIASIZE)
group.add_argument('-p', '--poster-size',
type=__parse_box, metavar="BOX",
help='Specify the poster size (defaults to media size). ')
group.add_argument('-s', '--scale', type=float,
help='Specify a linear scaling factor to produce the poster.')
parser.add_argument('infilename', metavar='InputFile')
parser.add_argument('outfilename', metavar='OutputFile')
args = parser.parse_args(args)
if args.scale is not None and args.poster_size is not None:
parser.error('Only one of -p/--poster-size and -s/--scale may be given at a time.')
if not args.poster_size:
args.poster_size = args.media_size.copy()
if args.scale is not None:
args.poster_size = None
if args.scale < 0.01:
parser.error("Scale value is much to small: %s" % args.scale)
elif args.scale > 1.0e6:
parser.error("Scale value is much to big: %s" % args.scale)
try:
main(args, infilename=args.infilename, outfilename=args.outfilename)
except DecryptionError as e:
raise SystemExit(str(e))
except PyPDF2.utils.PdfReadError as e:
parser.error('The input-file is either currupt or no PDF at all: %s'
% e)
if __name__ == '__main__': # pragma: no cover
run()
pdftools.pdfposter-0.7.post1/pdftools/pdfposter/__init__.py 0000755 0001750 0001750 00000030114 13316677212 025441 0 ustar hartmut hartmut 0000000 0000000 #!/usr/bin/env python
"""
pdftools.pdfposter - scale and tile PDF images/pages to print on multiple pages.
"""
#
# Copyright 2008-2018 by Hartmut Goebel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
__author__ = "Hartmut Goebel "
__copyright__ = "Copyright 2008-2018 by Hartmut Goebel "
__licence__ = "GNU General Public License version 3 (GPL v3)"
__version__ = "0.7.post1"
from PyPDF2.pdf import PdfFileWriter, PdfFileReader, PageObject, getRectangle, \
ArrayObject, ContentStream, NameObject, FloatObject, RectangleObject
import logging
from logging import log
import math
DEFAULT_MEDIASIZE = 'a4'
mm = 72 / 25.4
# Taken from poster.c
papersizes = {
'pt' : (1, 1),
'inch': (72, 72),
'ft' : (864, 864), # 12 inch
'mm' : (mm, mm),
'cm' : (10 *mm, 10 *mm),
'meter':(1000* mm, 1000* mm),
# American page sizes (taken from psposter.c)
"monarch" : (279, 540),
"statement": (396, 612),
"executive": (540, 720),
"quarto" : (610, 780),
"letter" : (612, 792),
"folio" : (612, 936),
"legal" : (612, 1008),
"tabloid" : (792, 1224),
"ledger" : (792, 1224),
# ISO page sizes (taken from psposter.c)
"a0" : (2384, 3370),
"a1" : (1684, 2384),
"a2" : (1191, 1684),
"a3" : (842, 1191),
"a4" : (595, 842),
"a5" : (420, 595),
"a6" : (298, 420),
"a7" : (210, 298),
"a8" : (147, 210),
"a9" : (105, 147),
"a10": (74, 105),
# DIN lang is considered to be a landscape format
"dinlang" : (595, 281), # 1/3 a4
"envdinlang": (624, 312), # envelope for Din lang
"b0" : (2835, 4008),
"b1" : (2004, 2835),
"b2" : (1417, 2004),
"b3" : (1001, 1417),
"b4" : (709, 1001),
"b5" : (499, 709),
"b6" : (354, 499),
"b7" : (249, 354),
"b8" : (176, 249),
"b9" : (125, 176),
"b10": (88, 125),
"c4" : (649, 918),
"c5" : (459, 649),
"c6" : (323, 459),
# Japanese page sizes (taken from psposter.c)
"jb0" : (2920, 4127),
"jb1" : (2064, 2920),
"jb2" : (1460, 2064),
"jb3" : (1032, 1460),
"jb4" : (729, 1032),
"jb5" : (516, 729),
"jb6" : (363, 516),
"jb7" : (258, 363),
"jb8" : (181, 258),
"jb9" : (128, 181),
"jb10": (91, 128),
# Envelope No. 10 is considered to be a landscape format
"comm10": (684, 298),
"com10" : (684, 298),
"env10" : (684, 298),
}
class DecryptionError(ValueError):
pass
PAGE_BOXES = ("/MediaBox", "/CropBox", "/BleedBox", "/TrimBox", "/ArtBox")
def rectangle2box(pdfbox):
return {
'width' : pdfbox.getUpperRight_x()-pdfbox.getLowerLeft_x(),
'height' : pdfbox.getUpperRight_y()-pdfbox.getLowerLeft_y(),
'offset_x': pdfbox.getLowerLeft_x(),
'offset_y': pdfbox.getLowerLeft_y(),
# the following are unused, but need to be set to make
# `rotate_box()` work
'units_x' : None,
'units_y' : None,
}
def rotate_box(box):
for a, b in (
('width', 'height'),
('offset_x', 'offset_y'),
('units_x', 'units_y')):
box[a], box[b] = box[b], box[a]
def rotate2portrait(box, which):
'if box is landscape spec, rotate to portrait'
if ( box['width' ]-box['offset_x']
> box['height']-box['offset_y']):
rotate_box(box)
log(18, 'Rotating %s specs to portrait format', which)
return True
def decide_num_pages(inbox, mediabox, posterbox, scale=None):
"""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']
rotate = False
inbox_x = float(inbox['width' ])
inbox_y = float(inbox['height'])
log(17, 'input dimensions: %.2f %.2f (trimbox of input page)',
inbox_x, inbox_y)
if not scale:
# user did not specify scale factor, calculate from output size
# todo: fix assuming posterbox offset = 0,0
log(17, 'output dimensions: %.2f %.2f (poster size)',
posterbox['width'], posterbox['height'])
# ensure poster spec are portrait
if rotate2portrait(posterbox, 'poster'):
rotate = rotate != True # xor
# if the input page has landscape format rotate the
# poster spec to landscape, too
if inbox_x > inbox_y:
log(18, 'Rotating poster specs since input page is landscape')
rotate = rotate != True # xor
rotate_box(posterbox)
log(18, 'rotated output dimensions: %.2f %.2f (poster size)',
posterbox['width'], posterbox['height'])
scale = min(posterbox['width' ] / inbox_x,
posterbox['height'] / inbox_y)
log(18, 'Calculated page scaling factor: %f', scale)
# use round() to avoid floating point roundup errors
size_x = round(inbox_x*scale - whitemargin['x'], 4)
size_y = round(inbox_y*scale - whitemargin['y'], 4)
log(17, 'output dimensions: %.2f %.2f (calculated)', size_x, size_y)
# num pages without rotation
nx0 = int(math.ceil(size_x / drawable_x))
ny0 = int(math.ceil(size_y / drawable_y))
# num pages with rotation
nx1 = int(math.ceil(size_x / drawable_y))
ny1 = int(math.ceil(size_y / drawable_x))
log(17, 'Pages w/o rotation %s x %s', nx0, ny0)
log(17, 'Pages w/ rotation %s x %s', nx1, ny1)
# Decide for rotation to get the minimum page count.
# (Rotation is considered as media versus input page, which is
# totally independent of the portrait or landscape style of the
# final poster.)
rotate = (rotate and (nx0*ny0) == (nx1*ny1)) or (nx0*ny0) > (nx1*ny1)
log(17, 'Decided for rotation: %s', rotate and 'yes' or 'no')
if rotate:
ncols = nx1
nrows = ny1
else:
ncols = nx0
nrows = ny0
log(19, "Deciding for %d column%s and %d row%s of %s pages.",
ncols, (ncols==1) and "s" or "",
nrows, (nrows==1) and "s" or "",
rotate and "landscape" or "portrait")
return ncols, nrows, scale, rotate
def copyPage(page):
newpage = PageObject()
newpage.update(page)
# Copy Rectangles to be manipulatable
for attr in PAGE_BOXES:
if attr in page:
newpage[NameObject(attr)] = RectangleObject(list(page[attr]))
return newpage
def _clip_pdf_page(page, x, y, width, height):
content = ContentStream(page["/Contents"].getObject(), None)
content.operations[:0] = [
([], 'q'), # save graphic state
(RectangleObject((x, y, width, height)), 're'), # rectangle path
([], 'W*'), # clip
([], 'n'), # cancel path w/ filling or stroking
]
content.operations.append([[], "Q"]) # restore graphic state
page[NameObject('/Contents')] = content
def _scale_pdf_page(outpdf, page, factor):
for boxname in PAGE_BOXES:
# skip if real box does not exits (avoid fallback to other boxes)
if not page.get(boxname):
continue
box = getRectangle(page, boxname, None)
box.lowerLeft = [float(i) * factor for i in box.lowerLeft ]
box.upperRight = [float(i) * factor for i in box.upperRight]
#print boxname, type(box), box
# put transformation matrix in front of page content
content = ContentStream(page["/Contents"].getObject(), None)
content.operations.insert(0, [[], '%f 0 0 %f 0 0 cm' %(factor,factor)] )
content = content.flateEncode()
# Add changed content as an indirect object. So the content will
# be referenced by the other pages and not copied. The content
# will be in the output file only once.
page[NameObject('/Contents')] = outpdf._addObject(content)
def posterize(outpdf, page, mediabox, posterbox, scale, use_ArtBox=False):
"""
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)
"""
if use_ArtBox:
inbox = rectangle2box(page.artBox)
else:
inbox = rectangle2box(page.trimBox)
_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)
mediabox = mediabox.copy()
_scale_pdf_page(outpdf, page, scale)
if rotate:
page.rotateClockwise(90)
rotate_box(inbox)
rotate_box(mediabox)
# area to put on each page (allows for overlay of margin)
h_step = mediabox['width'] - mediabox['offset_x']
v_step = mediabox['height'] - mediabox['offset_y']
if use_ArtBox:
trimbox = rectangle2box(page.artBox)
else:
trimbox = rectangle2box(page.trimBox)
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
for row in range(nrows):
log(17, 'Creating page with offset: %.2f %.2f' % (h_pos, v_pos))
newpage = copyPage(page)
# todo: if remaining area is smaller than mediaBox, add a
# transparent fill box behind, so the real content is in
# the lower left corner
newpage.mediaBox = RectangleObject((h_pos, v_pos,
h_pos + h_step,
v_pos + v_step))
newpage.trimBox = RectangleObject((h_pos, v_pos,
min(h_max, h_pos + h_step),
min(v_max, v_pos + v_step)))
newpage.artBox = newpage.trimBox
outpdf.addPage(newpage)
v_pos -= v_step
h_pos += h_step
def password_hook():
import getpass
return getpass.getpass()
def main(opts, infilename, outfilename, password_hook=password_hook):
logging.basicConfig(level=20-opts.verbose, format="%(message)s")
outpdf = PdfFileWriter()
inpdf = PdfFileReader(open(infilename, 'rb'))
if inpdf.isEncrypted:
log(16, 'File is encrypted')
# try empty password first
if not inpdf.decrypt(''):
if not inpdf.decrypt(password_hook()):
raise DecryptionError("Can't decrypt PDF. Wrong Password?")
first_page = 1
last_page = inpdf.numPages
if opts.first_page is not None:
first_page = max(1, opts.first_page)
if opts.last_page is not None:
last_page = min(last_page, opts.last_page)
log(18, 'Mediasize : %(units_x)sx%(units_y)s %(unit)s' % opts.media_size)
log(17, ' %(width).2f %(height).2f dots' % opts.media_size)
if opts.scale:
log(18, 'Scaling by: %f' % opts.scale)
else:
log(18, 'Postersize: %(units_x)sx%(units_y)s %(unit)s' % opts.poster_size)
log(17, ' %(width).2f %(height).2f dots' % opts.poster_size)
for i in range(first_page-1, last_page):
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)
if not opts.dry_run:
outpdf.write(open(outfilename, 'wb'))
pdftools.pdfposter-0.7.post1/pdftools.pdfposter.egg-info/ 0000755 0001750 0001750 00000000000 13316677212 025017 5 ustar hartmut hartmut 0000000 0000000 pdftools.pdfposter-0.7.post1/pdftools.pdfposter.egg-info/zip-safe 0000644 0001750 0001750 00000000001 13316677212 026447 0 ustar hartmut hartmut 0000000 0000000
pdftools.pdfposter-0.7.post1/pdftools.pdfposter.egg-info/top_level.txt 0000644 0001750 0001750 00000000011 13316677212 027541 0 ustar hartmut hartmut 0000000 0000000 pdftools
pdftools.pdfposter-0.7.post1/pdftools.pdfposter.egg-info/requires.txt 0000644 0001750 0001750 00000000007 13316677212 027414 0 ustar hartmut hartmut 0000000 0000000 PyPDF2
pdftools.pdfposter-0.7.post1/pdftools.pdfposter.egg-info/namespace_packages.txt 0000644 0001750 0001750 00000000011 13316677212 031342 0 ustar hartmut hartmut 0000000 0000000 pdftools
pdftools.pdfposter-0.7.post1/pdftools.pdfposter.egg-info/entry_points.txt 0000644 0001750 0001750 00000000072 13316677212 030314 0 ustar hartmut hartmut 0000000 0000000 [console_scripts]
pdfposter = pdftools.pdfposter.cmd:run
pdftools.pdfposter-0.7.post1/pdftools.pdfposter.egg-info/dependency_links.txt 0000644 0001750 0001750 00000000001 13316677212 031065 0 ustar hartmut hartmut 0000000 0000000
pdftools.pdfposter-0.7.post1/pdftools.pdfposter.egg-info/SOURCES.txt 0000644 0001750 0001750 00000002014 13316677212 026700 0 ustar hartmut hartmut 0000000 0000000 MANIFEST.in
README.txt
pdfposter.rst
setup.cfg
setup.py
docs/Development.rst
docs/Donate.rst
docs/Examples.rst
docs/Frequently Asked Questions.rst
docs/Installation.rst
docs/Makefile
docs/Usage.rst
docs/_box-definitions.txt
docs/_common_definitions.txt
docs/_description.txt
docs/_examples1.txt
docs/_examples2.txt
docs/_options.txt
docs/conf.py
docs/index.rst
docs/_images/bitcoin-pdfposter.png
docs/_images/poster-tall-1x2a4.png
docs/_images/poster-tall-2x1a4.png
docs/_images/poster-wide-1x2a4.png
docs/_images/poster-wide-2x1a4.png
docs/_images/testpage-tall.preview.png
docs/_images/testpage-wide.preview.png
docs/_static/custom.css
pdftools.pdfposter.egg-info/PKG-INFO
pdftools.pdfposter.egg-info/SOURCES.txt
pdftools.pdfposter.egg-info/dependency_links.txt
pdftools.pdfposter.egg-info/entry_points.txt
pdftools.pdfposter.egg-info/namespace_packages.txt
pdftools.pdfposter.egg-info/requires.txt
pdftools.pdfposter.egg-info/top_level.txt
pdftools.pdfposter.egg-info/zip-safe
pdftools/pdfposter/__init__.py
pdftools/pdfposter/cmd.py pdftools.pdfposter-0.7.post1/pdftools.pdfposter.egg-info/PKG-INFO 0000644 0001750 0001750 00000003700 13316677212 026114 0 ustar hartmut hartmut 0000000 0000000 Metadata-Version: 1.1
Name: pdftools.pdfposter
Version: 0.7.post1
Summary: Scale and tile PDF images/pages to print on multiple pages.
Home-page: https://pdfposter.readthedocs.io/
Author: Hartmut Goebel
Author-email: h.goebel@crazy-compilers.com
License: GPL 3.0
Download-URL: https://pypi.org/project/pdftools.pdfposter/
Description-Content-Type: UNKNOWN
Description:
``Pdfposter`` can be used to create a large poster by building it from
multiple pages and/or printing it on large media. It expects as input a
PDF file, normally printing on a single page. The output is again a
PDF file, maybe containing multiple pages together building the
poster.
The input page will be scaled to obtain the desired size.
This is much like ``poster`` does for Postscript files, but working
with PDF. Since sometimes poster does not like your files converted
from PDF. :-) Indeed ``pdfposter`` was inspired by ``poster``.
For more information please refere to the manpage or visit
the `project homepage `_.
Keywords: pdf poster
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Printing
Classifier: Topic :: Utilities
pdftools.pdfposter-0.7.post1/docs/ 0000755 0001750 0001750 00000000000 13316677212 020416 5 ustar hartmut hartmut 0000000 0000000 pdftools.pdfposter-0.7.post1/docs/index.rst 0000644 0001750 0001750 00000001653 13316677212 022264 0 ustar hartmut hartmut 0000000 0000000 ==============================================
pdftools.pdfposter
==============================================
.. container:: admonition topic
**Scale and tile PDF images/pages to print on multiple pages.**
|pdfposter| can be used to create a large poster by building it from
multiple pages and/or printing it on large media. It expects as input a
PDF file, normally printing on a single page. The output is again a
PDF file, maybe containing multiple pages together building the
poster. The input page will be scaled to obtain the desired size.
This is much like the well-known tool `poster` does for Postscript
files, but working with PDF. Since sometimes poster does not like your
files converted from PDF. :-) Indeed |pdfposter| was inspired by `poster`.
.. toctree::
:maxdepth: 1
Installation
Usage
Examples
Donate
Frequently Asked Questions
Development
.. include:: _common_definitions.txt
pdftools.pdfposter-0.7.post1/docs/conf.py 0000644 0001750 0001750 00000014540 13316677212 021721 0 ustar hartmut hartmut 0000000 0000000 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pdftools.PDFposter documentation build configuration file, created by
# sphinx-quickstart on Tue May 21 16:21:39 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.intersphinx']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'pdfposter'
copyright = '2008-2018, Hartmut Goebel'
author = 'Hartmut Goebel'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.7'
# The full version, including alpha/beta/rc tags.
release = '0.7.post1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%Y-%m-%d'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
'logo_name': True,
'logo_text_align': 'center',
'description': 'Scale and Tile PDF Pages',
'github_button': False,
'fixed_sidebar': True,
'show_related': False,
}
html_sidebars = {
'**': [
'about.html',
#'globaltoc.html',
'navigation.html',
'searchbox.html',
'donate.html',
]
}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# A shorter title for the navigation bar. Default is the same as html_title.
html_short_title = "pdfposter"
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = '../projectlogo.svg'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'pdfposterdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
(master_doc, 'pdfposter.tex', 'pdfposter Documentation',
'Hartmut Goebel', 'manual'),
]
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'pdftoolspdfposter', 'pdfposter Documentation',
['Hartmut Goebel'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'pdfposter', 'pdfposter Documentation',
'Hartmut Goebel', 'pdfposter', 'One line description of project.',
'Miscellaneous'),
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
pdftools.pdfposter-0.7.post1/docs/_options.txt 0000644 0001750 0001750 00000003312 13316677212 023010 0 ustar hartmut hartmut 0000000 0000000
General Options
--------------------
-h, --help Show help message and exit
--help-media-names List available media and distance names and exit
--help-box-definitions
Show help about specifying BOX for `--media-size`
and `--poster-size` and exit
--version Show program's version number and exit
-v, --verbose Be verbose. Tell about scaling, rotation and number of
pages. Can be used more than once to increase the
verbosity.
-n, --dry-run Show what would have been done, but do not generate files.
Defining Input
-----------------
-f, --first First page to convert (default: first page).
-l, --last Last page to convert (default: last page).
-A, --art-box Use the content area defined by the ArtBox (default:
use the area defined by the TrimBox)
Defining Output
-----------------
-m BOX, --media-size=BOX Specify the desired media size to print on.
See below for *BOX*. The default is A4 in the standard
package.
-p BOX, --poster-size=BOX Specify the poster size. See below for *BOX*.
pdfposter will autonomously choose scaling and rotation to
best fit the input onto the poster (see EXAMPLES below).
If you give neither the *-s* nor the *-p* option, the default
poster size is identical to the media size.
-s NUMBER Specify a linear scaling factor to produce the poster.
Together with the input image size and optional margins,
this induces an output poster size. So don't specify both *-s*
and *-p*.
Default is deriving the scale factor to fit a given poster
size.
pdftools.pdfposter-0.7.post1/docs/_examples2.txt 0000644 0001750 0001750 00000001072 13316677212 023216 0 ustar hartmut hartmut 0000000 0000000 Examples for automatic scaling
------------------------------------
* For printing 2 *portrait* A4 pages high (approx. 58cm) and let
pdfposter determine how many portrait pages wide, specify a large
number of *vertical* pages. eg:
:pdfposter -p999x2a4 testpage-wide.pdf out.pdf:
* For printing 2 *landscape* A4 pages high (approx. 20cm) and let
pdfposter determine how many landscape pages wide, specify a large
number of *horizontal* pages. eg:
:pdfposter -p2x999a4 testpage-wide.pdf out.pdf:
.. Emacs config:
Local Variables:
mode: rst
End:
pdftools.pdfposter-0.7.post1/docs/_examples1.txt 0000644 0001750 0001750 00000002534 13316677212 023221 0 ustar hartmut hartmut 0000000 0000000
:pdfposter -mA3 -pA0 a4.pdf out.pdf:
Prints an A4 input file on 8 A3 pages, forming an A0 poster.
:pdfposter -p3x3Let a4.pdf out.pdf:
Prints an inputfile on a poster of 3x3 Letter pages.
..
not yet implemented: margins
:pdfposter -mA0 -w2x2i input.pdf out.pdf:
Enlarges an inputfile to print on a large-media A0 capable
device, maintaining 2 inch margins:
:pdfposter -mA0 input.pdf out.pdf:
Enlarges an inputfile to print on a large-media A0 capable
device.
:pdfposter -s4 input.pdf out.pdf:
Enlarge an inputfile exactly 4 times, print on the default A4
media, and let ``pdfposter`` determine the number of pages
required.
..
not yet implemented
:pdfposter -mLegal -p1x1m -w10% -C5 input.pdf out.pdf:
Scale a postscript image to a poster of about 1 square meter,
printing on 'Legal' media, maintaining a 10% of 'Legal' size
as white margin around the poster. Print cutmark lines and grid
labels, but don't print cut mark arrow heads.
:pdfposter -m10x10cm -pa0 a4.pdf out.pdf:
Just to show how efficient ``pdfposter`` is: This will create a file
containing 192 pages, but only 15 times as big as the single page.
With a4.pdf being a quite empty page, this ratio should be even
better for filled pages.
.. Emacs config:
Local Variables:
mode: rst
End:
pdftools.pdfposter-0.7.post1/docs/_description.txt 0000644 0001750 0001750 00000002133 13316677212 023640 0 ustar hartmut hartmut 0000000 0000000
``pdfposter`` can be used to create a large poster by building it from
multiple pages and/or printing it on large media. It expects as input a
PDF file, normally printing on a single page. The output is again a
PDF file, maybe containing multiple pages together building the
poster.
The input page will be scaled to obtain the desired size.
.. comment
The output pages bear cutmarks and have slightly overlapping
images for easier assembling.
The program uses a simple but efficient method which is possible with
PDF: All new pages share the same data stream of the scaled page. Thus
resulting file grows moderately.
To control its operation, you need to specify either the size of the
desired poster or a scale factor for the image:
- Given the poster size, it calculates the required number of sheets
to print on, and from that a scale factor to fill these sheets
optimally with the input image.
- Given a scale factor, it derives the required number of pages from
the input image size, and positions the scaled image centered on
this area.
.. Emacs config:
Local Variables:
mode: rst
End:
pdftools.pdfposter-0.7.post1/docs/_common_definitions.txt 0000644 0001750 0001750 00000000045 13316677212 025200 0 ustar hartmut hartmut 0000000 0000000 .. |pdfposter| replace:: `pdfposter`
pdftools.pdfposter-0.7.post1/docs/_box-definitions.txt 0000644 0001750 0001750 00000003032 13316677212 024415 0 ustar hartmut hartmut 0000000 0000000
Box Definition
-----------------
The *BOX* mentioned above is a specification of horizontal and
vertical size. The syntax is as follows (with multiplier being
specified optionally):
*box* = [ *multiplier* ] *unit*
*multiplier* = *number* "x" *number*
*unit* = *medianame* or *distancename*
..
Only in combination with the *-i* option, the program
also understands the offset specification in the *BOX*.
= +,
[]
and offset
Many international media names are recognised by the program, in upper
and lower case, and can be shortened to their first few characters, as
long as unique. For instance 'A0', 'Let'. Distance names are like
'cm', 'inch', 'ft'.
Medias are typically not quadratic but rectangular, which means width
and height differ. Thus using media names is a bit tricky:
:10x20cm: obvious: 10 cm x 20 cm (portrait)
:20x10cm: same as 10x20cm, since all boxes are rotated to portrait
format
Now when using media names it gets tricky:
:1x1a4: same as approx. 21x29cm (21 cm x 29 cm, portrait)
:1x2a4: same as approx. 21x58cm (21 cm x 58 cm, portrait)
This are two a4 pages put together at the *small* side: One
portrait page wide and two portrait pages high.
:2x1a4: same as approx. 42x29cm, which is rotated to portrait and is
(approx.) the same as 29x42cm (29 cm x 42 cm)
This are two a4 pages put together at the *long* side: Two
portrait pages wide and one portrait page high.
.. Emacs config:
Local Variables:
mode: rst
End:
pdftools.pdfposter-0.7.post1/docs/Usage.rst 0000644 0001750 0001750 00000000224 13316677212 022212 0 ustar hartmut hartmut 0000000 0000000 ==============
Usage
==============
.. include:: _description.txt
Options
========
.. include:: _options.txt
.. include:: _box-definitions.txt
pdftools.pdfposter-0.7.post1/docs/Makefile 0000644 0001750 0001750 00000001143 13316677212 022055 0 ustar hartmut hartmut 0000000 0000000 # Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python3 -msphinx
SPHINXPROJ = pdfposter
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
pdftools.pdfposter-0.7.post1/docs/Installation.rst 0000644 0001750 0001750 00000005677 13316677212 023630 0 ustar hartmut hartmut 0000000 0000000
Download & Installation
=========================
Instructions for Windows Users
-----------------------------------
1. |pdfposter| requires Python. If you don't have Python installed already,
download and install Python 3.6 from https://python.org/download/3.6/
During installation, make sure to check "Include into PATH".
2. If you already have Python installed, please check that your Python
directory (normally :file:`C:\\Python36` for python 3.6) and the Python
Scripts directory (normally :file:`C:\\Python36\\Scripts`) are in the system
path. If not, just add them in :menuselection:`My Computer --> Properties
--> Advanced --> Environment Variables` to the :envvar:`Path` system
variable.
3. Install |pdfposter| by running ::
pip install pdftools.pdfposter
Then run the console command ``pdfposter --help`` to get detailed help.
If the command ``pip`` is unknown to you system, please refer to the
`pip homepage `_ for help.
Instructions for GNU/Linux and other Operating Systems
--------------------------------------------------------
Most current GNU/Linux distributions provide packages for |pdfposter|.
Simply search your distribution's software catalog.
Also many vendors provide Python, and some even provide |pdfposter|.
Please check your vendor's software repository.
If your distribution or vendor does not provide a current version of
|pdfposter| please read on.
If your vendor does not provide :command:`python`
please download Python 3.6 from https://www.python.org/download/ and
follow the installation instructions there.
If you distribution or vendor missed providing :command:`pip`,
alongside :command:`python`,
please check your vendor's or distribution's software repository
for a package called `pip` or `python-pip`.
If this is not provided, please refer to the
`pip homepage `_ for help.
Optionally you might want to install `PyPDF2`
- which is a requirement for |pdfposter| -
provided by your distribution or vendor
so at least this package will be maintained by your distribution.
Check for a package named ``python-pypdf2`` or that like.
Then continue with :ref:`installing pdfposter` below.
.. _installing pdfposter:
Installing |pdfposter| using :command:`pip`
---------------------------------------------
After installing `Python` (and optionally `PyPDF2`), just run::
sudo pip install pdftools.pdfposter
to install |pdfposter| for all users.
For installing |pdfposter| for yourself only, run::
pip install --user pdftools.pdfposter
If your system does not have network access
- download |pdfposter| from https://pypi.org/project/pdftools.pdfposter/,
- downlaod `PyPDF2` from https://pypi.org/project/PyPDF2/, and
- run ::
sudo pip install pdftools.pdfposter-*.tar.gz PyPDF2-*.tar.gz
respective ::
pip install --user pdftools.pdfposter-*.tar.gz PyPDF2-*.tar.gz
.. include:: _common_definitions.txt
pdftools.pdfposter-0.7.post1/docs/Frequently Asked Questions.rst 0000644 0001750 0001750 00000002670 13316677212 026276 0 ustar hartmut hartmut 0000000 0000000 Frequently Asked Questions
===============================
* *How can I suppress these superfluous empty pages?*
*Short Answer:* Specify the desired output size using the same
page-name as the medium-size::
pdfposter -mA5 -p2xA5 in.pdf out.pdf
*Long Answer*: If you are running::
pdfposter -mA5 -pA4 in.pdf out.pdf
you most probably expect the result to be 2 A5-pages large, but you
will get *three* pages, where the third seams to be empty. (If you
have a full-colored background, you will find a small line on the
third page.)
And this is what went wrong:
In the command above, you *say*: "The output should be A4 sized",
while you *mean*: "The output should fit on two A5 pages".
Basically you are right, if you say "hey, this ought to be the
same!". It is a scaling or rounding issue caused by ISO page sizes
not scaling exactly (even as they should, see `ISO 216
`_). For example since A4 is
297 mm high, A5 should be 148.5 mm wide, but is only 148 mm wide.
So the solution is to specify on the command-line what you want:
"should fit on two A5 pages"::
pdfposter -mA5 -p2xA5 in.pdf out.pdf
* Are there other Python tools for manipulating PDF?
Yes, there are:
* `pdfnup `_
* `pdfsplit `_
* `pdfgrid `_
.. include:: _common_definitions.txt
pdftools.pdfposter-0.7.post1/docs/Examples.rst 0000644 0001750 0001750 00000004253 13316677212 022732 0 ustar hartmut hartmut 0000000 0000000 Examples
===============================
These are some examples showing how to get a poster as you want.
.. include:: _examples1.txt
.. include:: _examples2.txt
For these examples we use two input pages:
.. figure:: _images/testpage-tall.preview.png
:align: center
:alt: ..
:scale: 33%
:figwidth: 45%
The *tall* example input page (5.0 cm x 27.9 cm)
.. figure:: _images/testpage-wide.preview.png
:align: center
:alt: ..
:scale: 33%
:figwidth: 45%
The *wide* example input page (27.9 cm x 5.0 cm).
These are intentionally uncommon formats so the effects of running
|pdfposter| will be more demonstrative.
Working With Portrait Images
-------------------------------------
Portrait images are higher than wide.
.. image:: _images/poster-tall-2x1a4.png
:scale: 50%
:align: right
:alt: Tall test-page as poster: Two portrait pages wide and one portrait page high.
Example 1::
pdfposter -p 2x1a4 testpage-tall.pdf out.pdf
This are two a4 pages put together at the *long* side: Two portrait
pages wide and one portrait page high.
.. image:: _images/poster-tall-1x2a4.png
:scale: 50%
:align: right
:alt: Tall test-page as poster: One portrait page wide and two portrait pages high.
Example 2::
pdfposter -p 1x2a4 testpage-tall.pdf out.pdf
This are two a4 pages put together at the *small* side: One portrait
page wide and two portrait pages high.
Working With Landscape Images
------------------------------------
Landscape images are wider than height.
.. image:: _images/poster-wide-2x1a4.png
:scale: 50%
:align: right
:alt: Wide test-page as poster: Two portrait pages wide and one portrait page high.
Example 1::
pdfposter -p 2x1a4 testpage-wide.pdf out.pdf
This are two a4 pages put together at the long side: Two portrait pages wide and one portrait page high.
.. image:: _images/poster-wide-1x2a4.png
:scale: 50%
:align: right
:alt: Wide test-page as poster: One portrait page wide and two portrait pages high.
Example 2::
pdfposter -p 1x2a4 testpage-wide.pdf out.pdf
This are two a4 pages put together at the small side: One portrait page wide and two portrait pages high.
.. include:: _common_definitions.txt
pdftools.pdfposter-0.7.post1/docs/Donate.rst 0000644 0001750 0001750 00000003562 13316677212 022370 0 ustar hartmut hartmut 0000000 0000000 Donations
==============
.. container:: admonition topic
**If you like pdfposter, please consider supporting me in some way.**
.. container:: box1
.. centered:: Bank transfers
While PayPal_ donations are still very much appreciated PayPal takes a
large cut and has rather questionable business practices.
If you have the ability to make SEPA bank transfers at a low cost (for
example if you live within the EU) please contact `Hartmut
`_ to ask for his bank details.
.. container:: box2
I trust in the power of free and open source software and thus made the
entire source code publicly available for every one to use. However, it
takes a lot of time to develop the software and manage the community. And I
still need to make my living.
So, if you like the software, please consider donating, especially if your
organization benefits from this project.
Thank you!
.. figure:: _images/bitcoin-pdfposter.png
:align: right
:alt: QR-Code for Bitcoin address
Bitcoin address
* **Bitcoin:** `13qryeeJR5Hc7vR5AmQMWDuLzDEgSDNJi2
`_
* **Bank-Transfer (prefered):**
If you have the ability to make SEPA bank transfers at a low cost
please `contact me `_
and I'll send you the account details.
If you want a bill, please state so and also leave your name and address.
* **PayPal:** |PayPalDonate|_ -
if you want a bill, please state so and leave your name, address and
email-address.
* Please `contact me `_
to arrange some other kind of project grant, e.g. consulting or support.
.. |PayPalDonate| replace:: Donate
.. _PayPalDonate: PayPal_
.. _PayPal: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=M6LW5EZANT9ZA
.. include:: _common_definitions.txt
pdftools.pdfposter-0.7.post1/docs/Development.rst 0000644 0001750 0001750 00000001340 13316677212 023430 0 ustar hartmut hartmut 0000000 0000000 Development
===============================
The source of |pdfposter| and its siblings is maintained at
`GitLab `_. Patches and pull-requests
are hearty welcome.
* Please submit bugs and enhancements to the `Issue Tracker
`_.
* You may browse the code at the
`Repository Browser
`_.
Or you may check out the current version by running ::
git clone https://gitlab.com/pdftools/pdfposter.git
*Historical Note:*
|pdfposter| was hosted at origo.ethz.ch, which closed in May 2012.
Then |pdfposter| was hosted on gitorious.org,
which was closed in May 2015 and merged into gitlab.
.. include:: _common_definitions.txt
pdftools.pdfposter-0.7.post1/docs/_static/ 0000755 0001750 0001750 00000000000 13316677212 022044 5 ustar hartmut hartmut 0000000 0000000 pdftools.pdfposter-0.7.post1/docs/_static/custom.css 0000644 0001750 0001750 00000002202 13316677212 024064 0 ustar hartmut hartmut 0000000 0000000 div#examples.section table.docutils.field-list .field-body {
padding-top: 0.25em;
padding-bottom: 1em;
padding-left: 2em;
}
div#examples.section #id1.figure { float: left }
div#examples.section #id2.figure { float: right }
div#examples.section #id2.figure img { padding: 66pt 0; }
div#examples.section #id2.figure + * { clear: left }
div.sphinxsidebar li.toctree-l1 ~ li.toctree-l1 {
border-top: dotted thin #AAA;
margin-top: 0.3em;
padding-top: 0.3em;
}
div.sphinxsidebar a {
text-decortation: none;
border-bottom: none;
}
/* make refs, which are links, visible as being links */
a.reference.internal code span.pre {
border-bottom: dotted 1px #004B6B; /* same as for "a.reference" */
}
div#donations.section > .box1 {
width: 50%;
border: solid thin lightseagreen;
border-radius: 1em;
float: right;
margin-left: 0.5em;
padding-left: 0.5em;
}
div#donations.section > .box1 > .centered {
color: seagreen;
}
div#donations.section > .box2 + * {
clear: both;
}
div#donations.section >ul li {
margin-bottom: 0.5em
}
div#donations.section .figure.align-center {
float: left;
padding: 0 3em;
}
pdftools.pdfposter-0.7.post1/docs/_images/ 0000755 0001750 0001750 00000000000 13316677212 022022 5 ustar hartmut hartmut 0000000 0000000 pdftools.pdfposter-0.7.post1/docs/_images/testpage-wide.preview.png 0000644 0001750 0001750 00000072532 13316677212 026763 0 ustar hartmut hartmut 0000000 0000000 PNG
IHDR l IDATxwxUU?M$n ;*bÂE2b_PGgFQ MBz!{o}.'OeZ{ާ """ ~H"iSnɔhS?Sx*Je_
[l?_+5gfdTqc8%"◊'5UMd[ztZM|"q2nFŧG##h\ܔ^ey*7}Xu]<_ >
!P_Uf"-fGd̊t1],Mp)6]D.a3=X`*'x)p,6_S=QPƫ| wJ.PQeT?yLRTx::Y*"NV/KUdUdu