ralsina / pdfrw

Automatically exported from code.google.com/p/pdfrw
Other
0 stars 0 forks source link

crashes in makerl #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Go to example/rl1/
2. run subset.py test.pdf 1 1
3.

What is the expected output? What do you see instead?
I expect it to run, instead I get an error:

~/svn/pdfrw/examples/rl1$ python subset.py side1.pdf 1 1
Traceback (most recent call last):
  File "subset.py", line 43, in <module>
    go(inpfn, firstpage, lastpage)
  File "subset.py", line 36, in go
    canvas.doForm(makerl(canvas, page))
  File "~/svn/pdfrw/pdfrw/toreportlab.py", line 138, in makerl
    rlobj = makerl_recurse(doc, pdfobj)
  File "~/svn/pdfrw/pdfrw/toreportlab.py", line 131, in makerl_recurse
    return func(rldoc, pdfobj)
  File "~/svn/pdfrw/pdfrw/toreportlab.py", line 94, in _makestream
    rldict[key[1:]] = makerl_recurse(rldoc, value)
  File "~/svn/pdfrw/pdfrw/toreportlab.py", line 131, in makerl_recurse
    return func(rldoc, pdfobj)
  File "~/svn/pdfrw/pdfrw/toreportlab.py", line 72, in _makedict
    rldict[key[1:]] = makerl_recurse(rldoc, value)
  File "~/svn/pdfrw/pdfrw/toreportlab.py", line 131, in makerl_recurse
    return func(rldoc, pdfobj)
  File "~/svn/pdfrw/pdfrw/toreportlab.py", line 72, in _makedict
    rldict[key[1:]] = makerl_recurse(rldoc, value)
  File "~/svn/pdfrw/pdfrw/toreportlab.py", line 131, in makerl_recurse
    return func(rldoc, pdfobj)
  File "~/svn/pdfrw/pdfrw/toreportlab.py", line 108, in _makearray
    mylist = rlobj.sequence
AttributeError: PDFObjectReference instance has no attribute 'sequence'

What version of the product are you using? On what operating system?
Subversion revision 82
On Linux.

Please provide any additional information below.
Don't know if this helps, but if I place a try/except around the sequence
usage like so:
    try:
        mylist = rlobj.sequence
        for value in pdfobj:   
            mylist.append(makerl_recurse(rldoc, value))
        print dir(rlobj)
    except:
        print dir(rlobj)

    return rlobj

I get the following output:
['__PDFObject__', '__doc__', '__init__', '__module__', 'format', 'name']
['__PDFObject__', '__doc__', '__init__', '__module__', 'format', 'name']
['__PDFObject__', '__doc__', '__init__', '__module__', 'format', 'name']
['References', '__PDFObject__', '__doc__', '__init__', '__module__',
'format', 'multiline', 'sequence']
['References', '__PDFObject__', '__doc__', '__init__', '__module__',
'format', 'multiline', 'sequence']
['References', '__PDFObject__', '__doc__', '__init__', '__module__',
'format', 'multiline', 'sequence']
['References', '__PDFObject__', '__doc__', '__init__', '__module__',
'format', 'multiline', 'sequence']

Ah, and it works.. (output file seems correct anyways) :)

Original issue reported on code.google.com by asan...@gmail.com on 12 Jan 2010 at 11:20

GoogleCodeExporter commented 9 years ago
Indirect arrays were not being properly copied.  I think I fixed that bug in
subversion revision 83.  Please see if this fixes the problem on your PDF file, 
and
update the bug status appropriately.

Thanks!

Original comment by pmaupin on 12 Jan 2010 at 3:15

GoogleCodeExporter commented 9 years ago
Works for me! Thank you! :)

Original comment by asan...@gmail.com on 12 Jan 2010 at 4:04

GoogleCodeExporter commented 9 years ago
Reported fixed by user.

Original comment by pmaupin on 12 Jan 2010 at 4:08