pdfposter hangs with no output

Bug #1846464 reported by Brian Wharton
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pdfposter (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Just installed version 0.6.0 from the repository for 18.04 and when creating a poster the program just hangs, no msg, no output.
After a ctrl-c the following occured:

pdfposter --scale=4 Micro-Magic_Plan_2016_V2.pdf Plan.pdf
^CTraceback (most recent call last):
  File "/usr/bin/pdfposter", line 9, in <module>
    load_entry_point('pdftools.pdfposter==0.6.0', 'console_scripts', 'pdfposter')()
  File "/usr/share/pdfposter/pdftools/pdfposter/cmd.py", line 129, in run
    main(opts, *args)
  File "/usr/share/pdfposter/pdftools/pdfposter/__init__.py", line 340, in main
    outpdf.write(open(outfilename, 'wb'))
  File "/usr/lib/python2.7/dist-packages/PyPDF2/pdf.py", line 501, in write
    obj.writeToStream(stream, key)
  File "/usr/lib/python2.7/dist-packages/PyPDF2/generic.py", line 785, in writeToStream
    self[NameObject("/Length")] = NumberObject(len(self._data))
  File "/usr/lib/python2.7/dist-packages/PyPDF2/pdf.py", line 2769, in _getData
    op.writeToStream(newdata, None)
  File "/usr/lib/python2.7/dist-packages/PyPDF2/generic.py", line 252, in writeToStream
    stream.write(b_(repr(self)))
  File "/usr/lib/python2.7/dist-packages/PyPDF2/generic.py", line 242, in __repr__
    o = "%.5f" % self
TypeError: float argument required, not FloatObject

I have the latest versions of python2 installed.

Revision history for this message
Brian Wharton (brnwharton) wrote :

Moved to pdfposter (ubuntu)

affects: ubuntu-manpage-repository → pdfposter (Ubuntu)
Revision history for this message
Brian Foster (blfoster) wrote :

I just tried (also 0.6.0 on 18.04 (up-to-date)) and it seemed to work.
(Unfortunately, I canNOT attach the test PDF I used because it contains
very sensitive information.)
This suggests there is something in the PDF you used which is causing this behaviour.
As such, if it is possible, perhaps you should consider attaching the causes-to-fail PDF?

Revision history for this message
Brian Wharton (brnwharton) wrote : Re: [Bug 1846464] Re: pdfposter hangs with no output
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pdfposter (Ubuntu):
status: New → Confirmed
Revision history for this message
Brian Foster (blfoster) wrote :

Now confirmed, using the PDF kindly attached in #3.
There actually is some output, the output file `Plan.pdf' has been created
and is --- slowly --- relentlessly growing. It grew to c.68MiB by letting
pdfposter(1) run for 10mins (real-time) solid, fully occupying one of my
cores (100% of one CPU). However, the memory usage did_not_ increase.
When I finally gave up and ^C'ed, I got:

$ pdfposter --scale=4 Micro-Magic_Plan_2016_V2.pdf Plan.pdf
^CTraceback (most recent call last):
  File "/usr/bin/pdfposter", line 9, in <module>
    load_entry_point('pdftools.pdfposter==0.6.0', 'console_scripts', 'pdfposter')()
  File "/usr/share/pdfposter/pdftools/pdfposter/cmd.py", line 129, in run
    main(opts, *args)
  File "/usr/share/pdfposter/pdftools/pdfposter/__init__.py", line 340, in main
    outpdf.write(open(outfilename, 'wb'))
  File "/usr/lib/python2.7/dist-packages/PyPDF2/pdf.py", line 501, in write
    obj.writeToStream(stream, key)
  File "/usr/lib/python2.7/dist-packages/PyPDF2/generic.py", line 785, in writeToStream
    self[NameObject("/Length")] = NumberObject(len(self._data))
  File "/usr/lib/python2.7/dist-packages/PyPDF2/pdf.py", line 2771, in _getData
    newdata.write(b_(operator))
KeyboardInterrupt
$

Unsurprisingly, the output `Plan.pdf' is incomplete and/or corrupt.

I do_not_ know whether it would complete if I had the patience and disc space
to let in churn away.

Revision history for this message
Brian Foster (blfoster) wrote :

Here is a hypothesis for what is going on: It's working,
doing what it was told to do, but what it was told to do
is probably not what is intended.

First, a closer look at the example input PDF shows there
is an oddity (not wrong, just odd):

   $ pdfinfo -box Micro-Magic_Plan_2016_V2.pdf
  [...]
   Page size: 2961.3 x 2094.21 pts
  [...]

However, A4 paper is 210 x 297 millimetres, or more to the
point here (excuse the pun), 595 x 842 pts. That means the
full-sized image is already more than four times as large as
a single sheet of A4 paper (portrait, which is the default).
Hence, `--scale=4' is going to produce an image that is more
than 16x the size of A4 width (and correspondingly as high):

   $ pdfposter --dry-run --verbose --verbose --verbose --scale=4 Micro-Magic_Plan_2016_V2.pdf /dev/null
   Mediasize : 1.0x1.0 a4
            595.00 842.00 dots
   Scaling by: 4.000000
   ---- processing page 1 -----
   input dimensions: 2961.30 2094.21 (trimbox of input page)
   output dimensions: 11845.20 8376.84 (calculated)
   Pages w/o rotation 20 x 10
   Pages w/ rotation 15 x 15
   Decided for rotation: no
   Deciding for 20 column and 10 row of portrait pages.
   ^C
 [...]

That's a BIG poster: 20 A4 pages wide (4.2 metres), and 10 A4
pages high (almost 3 metres), on a total of 200 sheets. I'm
not surprised it's taking a long time to generate a very large
output. (The use of `--dry-run' and `/dev/null' are attempts
to avoiding having to ^C (unsuccessfully).)

Presuming what is wanted is a poster four times the size of a
sheet of A4, then, since the image already is about that size,
my suggestion is to use `--scale=1':

  $ pdfposter -m2x1a4 --verbose --verbose --verbose --scale=1 Micro-Magic_Plan_2016_V2.pdf Plan1-landscape.pdf
   Mediasize : 2.0x1.0 a4
               1190.00 842.00 dots
   Scaling by: 1.000000
   ---- processing page 1 -----
   input dimensions: 2961.30 2094.21 (trimbox of input page)
   output dimensions: 2961.30 2094.21 (calculated)
   Pages w/o rotation 3 x 3
   Pages w/ rotation 4 x 2
   Decided for rotation: yes
   Deciding for 4 column and 2 row of landscape pages.
   Creating page with offset: 0.00 1190.00
   Creating page with offset: 0.00 0.00
   Creating page with offset: 842.00 1190.00
   Creating page with offset: 842.00 0.00
   Creating page with offset: 1684.00 1190.00
   Creating page with offset: 1684.00 0.00
   Creating page with offset: 2526.00 1190.00
   Creating page with offset: 2526.00 0.00
   $

That's a full-size image on only 8 sheets (landscape),
or just over one metre wide and sightly less than 500cm
high (half a metre). Which seems, to me, reasonable.
(I do NOT know if the `-m2x1a4' is actually useful?)

And it does work, albeit it still takes a long time to
process: On my system, 12 minutes (100% CPU), generating
an 80 MiB output file. (I have not printed the output,
but it looks Ok in a PDF viewer (Okular).)

Scaling up to the original 200 sheets of `--scale=4'
suggests it would take about 300 minutes (5 hours),
and generate a 2000 MiB (2 GiB) output file. I do not
intend to test these estimates! ;-)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.