[reportlab-users] ANN: pdfnup 0.3.0

Luc Saffre luc.saffre at gmx.net
Mon Dec 22 10:07:18 EST 2008


Dinu,

here is a next bug report, consider it as a Christmas gift ;-)

Now I tested it on a similar file, created using pdflatex. The .tex
input file is here:

http://lino.saffre-rumma.ee/dl/pdfnup_test.tex

and the resulting pdf is here:

http://lino.saffre-rumma.ee/dl/pdfnup_test.pdf

And here is the traceback I get when I try pdfnup_test.py on it:

C:\temp>python pdfnup_test.py pdfnup_test.pdf
Traceback (most recent call last):
File "pdfnup_test.py", line 3, in <module>
generateNup(sys.argv[1],2)
File "s:\py-site-packages\pdfnup-0.3.3\pdfnup.py", line 307, in
generateNup
output.write(outputStream)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 167, in write
self._sweepIndirectReferences(externalReferenceMap, self._root)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 242, in
_sweepIndirectReferences
self._sweepIndirectReferences(externMap, realdata)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 218, in
_sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 242, in
_sweepIndirectReferences
self._sweepIndirectReferences(externMap, realdata)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 218, in
_sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 227, in
_sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, data[i])
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 242, in
_sweepIndirectReferences
self._sweepIndirectReferences(externMap, realdata)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 218, in
_sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 218, in
_sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 218, in
_sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 248, in
_sweepIndirectReferences
newobj = data.pdf.getObject(data)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 546, in getObject
idnum, generation = self.readObjectHeader(self.stream)
File "s:\py-site-packages\pyPdf-1.12\pyPdf\pdf.py", line 593, in
readObjectHeader
return int(idnum), int(generation)
ValueError: invalid literal for int() with base 10: ''

Merry Christmas! (in case we don't write before)
Luc

On 22.12.2008 13:27, Dinu Gherman wrote:

> Luc Saffre:

>

>> Dinu,

>>

>> thanks for you work so far! I downloaded

>> http://www.dinu-gherman.net/tmp/pdfnup-0.3.3.tar.gz

>> and created a file pdfnup_test.py:

>>

>> import sys

>> from pdfnup import generateNup

>> generateNup(sys.argv[1],2)

>>

>> This failed on a simple PDF file generated by OpenOffice:

>>

>> C:\temp>python pdfnup_test.py pdfnup_test.pdf

>> Traceback (most recent call last):

>> File "pdfnup_test.py", line 3, in <module>

>> generateNup(sys.argv[1],2)

>> File "s:\py-site-packages\pdfnup-0.3.3\pdfnup.py", line 284, in

>> generateNup

>> rotation = page2["/Rotate"].getObject()

>> File "s:\py-site-packages\pyPdf-1.12\pyPdf\generic.py", line 466, in

>> __getitem__

>> return dict.__getitem__(self, key).getObject()

>> KeyError: '/Rotate'

>>

>> The file I used for testing is here:

>>

>> http://lino.saffre-rumma.ee/dl/pdfnup_test.pdf

>>

>> Any idea?

>

>

> Hi Luc,

>

> sure, use the patch I've sent you on Dec, 12th via private

> email. If you didn't receive it, please find it below.

>

> Regards,

>

> Dinu

>

>

> $ diff -u pdfnup.py pdfnupX.py

> --- pdfnup.py 2008-11-17 13:26:02.000000000 +0100

> +++ pdfnupX.py 2008-12-19 11:02:25.000000000 +0100

> @@ -281,7 +281,10 @@

> page2Content.operations.insert(0, [[], "q"])

>

> # handle rotation

> - rotation = page2["/Rotate"].getObject()

> + try:

> + rotation = page2["/Rotate"].getObject()

> + except:

> + rotation = 0

> if rotation in (180, 270):

> dw, dh = destWidth, destHeight

> arr = [-xScale, 0, 0, -yScale, destX+dw, destY+dh]

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>




More information about the reportlab-users mailing list