Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hi List,
- I'm working on a PDF parser using Poppler. Part of the game is to extract the inner links and convert them to a usable format.
- I'm using that code:
- [...]
- elsif(action.is_a?(Poppler::ActionGotoDest))
- puts "Destination: page_num: %d, top: %f, left: %f, right: %f, zoom: %f, dest: %s" %
- [action.dest.page_num, action.dest.top, action.dest.left, action.dest.right, action.dest.zoom, action.dest.named_dest]
- namedDest = action.dest.named_dest
- puts namedDest
- if (namedDest != nil) then
- dest = @poppler.find_dest(namedDest)
- end
- end
- [...]
- to handle the ActionGotoDest links.
- However, when running it, I get a segfault with the following stack trace:
- crackpot:~/ruby/pdfparser$ ruby1.9.1 runtime.rb
- Page: 1, width: 612, height: 792
- x1: 0.152242, x2: 0.327596, y1: 0.125557, y2: 0.139822, action: #<Poppler::ActionUri:0x000000024761f0>
- URI: http://xxx.lanl.gov/hypertex/
- x1: 0.789634, x2: 0.846529, y1: 0.140740, y2: 0.154917, action: #<Poppler::ActionUri:0x00000002475f20>
- URI: http://xxx.lanl.gov/hypertex/
- x1: 0.152242, x2: 0.463363, y1: 0.212577, y2: 0.223999, action: #<Poppler::ActionGotoDest:0x00000002520b50>
- Destination: page_num: 0, top: 0.000000, left: 0.000000, right: 0.000000, zoom: 0.000000, dest: section.10
- section.10
- /home/chloe/ruby/pdfparser/PDFParser.rb:83: [BUG] Segmentation fault
- ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
- -- control frame ----------
- c:0011 p:---- s:0044 b:0044 l:000043 d:000043 CFUNC :find_dest
- c:0010 p:0371 s:0040 b:0040 l:000010 d:000039 BLOCK /home/chloe/ruby/pdfparser/PDFParser.rb:83
- c:0009 p:---- s:0029 b:0029 l:000028 d:000028 FINISH
- c:0008 p:---- s:0027 b:0027 l:000026 d:000026 CFUNC :each
- c:0007 p:0092 s:0024 b:0024 l:000010 d:000023 BLOCK /home/chloe/ruby/pdfparser/PDFParser.rb:67
- c:0006 p:---- s:0016 b:0016 l:000015 d:000015 FINISH
- c:0005 p:---- s:0014 b:0014 l:000013 d:000013 CFUNC :each
- c:0004 p:0088 s:0011 b:0011 l:000010 d:000010 METHOD /home/chloe/ruby/pdfparser/PDFParser.rb:61
- c:0003 p:0065 s:0007 b:0007 l:0005d8 d:000f40 EVAL runtime.rb:8
- c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
- c:0001 p:0000 s:0002 b:0002 l:0005d8 d:0005d8 TOP
- ---------------------------
- -- Ruby level backtrace information ----------------------------------------
- runtime.rb:8:in `<main>'
- /home/chloe/ruby/pdfparser/PDFParser.rb:61:in `DumpLinks'
- /home/chloe/ruby/pdfparser/PDFParser.rb:61:in `each'
- /home/chloe/ruby/pdfparser/PDFParser.rb:67:in `block in DumpLinks'
- /home/chloe/ruby/pdfparser/PDFParser.rb:67:in `each'
- /home/chloe/ruby/pdfparser/PDFParser.rb:83:in `block (2 levels) in DumpLinks'
- /home/chloe/ruby/pdfparser/PDFParser.rb:83:in `find_dest'
- -- C level backtrace information -------------------------------------------
- /usr/lib/libruby-1.9.1.so.1.9(rb_vm_bugreport+0x61) [0x7f544a838db1]
- /usr/lib/libruby-1.9.1.so.1.9(+0x592fe) [0x7f544a7402fe]
- /usr/lib/libruby-1.9.1.so.1.9(rb_bug+0xa5) [0x7f544a740d55]
- /usr/lib/libruby-1.9.1.so.1.9(+0xf3c84) [0x7f544a7dac84]
- /lib/x86_64-linux-gnu/libc.so.6(+0x36420) [0x7f544a37e420]
- /usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux/glib2.so(rbgobj_ruby_object_from_instance2+0x1a) [0x7f5448d6d13a]
- /usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux/poppler.so(+0xb366) [0x7f54409f1366]
- /usr/lib/libruby-1.9.1.so.1.9(+0x14aac6) [0x7f544a831ac6]
- /usr/lib/libruby-1.9.1.so.1.9(+0x141806) [0x7f544a828806]
- /usr/lib/libruby-1.9.1.so.1.9(+0x14743d) [0x7f544a82e43d]
- /usr/lib/libruby-1.9.1.so.1.9(rb_yield+0x26e) [0x7f544a833f2e]
- /usr/lib/libruby-1.9.1.so.1.9(rb_ary_each+0x46) [0x7f544a7177d6]
- /usr/lib/libruby-1.9.1.so.1.9(+0x14aac6) [0x7f544a831ac6]
- /usr/lib/libruby-1.9.1.so.1.9(+0x141806) [0x7f544a828806]
- /usr/lib/libruby-1.9.1.so.1.9(+0x14743d) [0x7f544a82e43d]
- /usr/lib/libruby-1.9.1.so.1.9(rb_yield+0x26e) [0x7f544a833f2e]
- /usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux/poppler.so(+0xb270) [0x7f54409f1270]
- /usr/lib/libruby-1.9.1.so.1.9(+0x14aac6) [0x7f544a831ac6]
- /usr/lib/libruby-1.9.1.so.1.9(+0x141806) [0x7f544a828806]
- /usr/lib/libruby-1.9.1.so.1.9(+0x14743d) [0x7f544a82e43d]
- /usr/lib/libruby-1.9.1.so.1.9(rb_iseq_eval_main+0xb2) [0x7f544a835432]
- /usr/lib/libruby-1.9.1.so.1.9(+0x5d4a2) [0x7f544a7444a2]
- /usr/lib/libruby-1.9.1.so.1.9(ruby_exec_node+0x1d) [0x7f544a744f9d]
- /usr/lib/libruby-1.9.1.so.1.9(ruby_run_node+0x1e) [0x7f544a746bde]
- ruby1.9.1(main+0x4b) [0x4007fb]
- /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f544a36930d]
- ruby1.9.1() [0x400829]
- [NOTE]
- You may have encountered a bug in the Ruby interpreter or extension libraries.
- Bug reports are welcome.
- For details: http://www.ruby-lang.org/bugreport.html
- Aborted
- The PDF document I use for test purpose is:
- ftp://tug.ctan.org/tex-archive/macros/latex/contrib/hyperref/doc/manual.pdf
- My Ruby:
- crackpot:~/ruby/pdfparser$ ruby1.9.1 -v
- ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
- My ruby-gtk2:
- Package: ruby-gtk2
- New: yes
- State: installed
- Automatically installed: no
- Version: 1.0.0-1
- Priority: optional
- Section: universe/ruby
- Maintainer: Ubuntu Developers <[email protected]>
- Uncompressed Size: 3,318 k
- Depends: libc6 (>= 2.4), libcairo2 (>= 1.2.4), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.24.0), libgtk2.0-0 (>= 2.20.0), libpango1.0-0 (>= 1.14.0), libruby1.8 (>= 1.8.7.352), libruby1.9.1 (>= 1.9.2.290), libx11-6, ruby-atk (= 1.0.0-1), ruby-pango (= 1.0.0-1),
- ruby-gdk-pixbuf2 (= 1.0.0-1)
- Conflicts: libgda-ruby1.8, libgda-ruby1.8, libgtk-trayicon-ruby1.8, libgtk-trayicon-ruby1.8, ruby-gtk2
- Breaks: libgtk2-ruby (< 0.90.9-1~), libgtk2-ruby (< 0.90.9-1~), libgtk2-ruby1.8 (< 0.90.9-1~), libgtk2-ruby1.8 (< 0.90.9-1~)
- Replaces: libgtk-trayicon-ruby1.8, libgtk-trayicon-ruby1.8, libgtk2-ruby (< 0.90.9-1~), libgtk2-ruby (< 0.90.9-1~), libgtk2-ruby1.8 (< 0.90.9-1~), libgtk2-ruby1.8 (< 0.90.9-1~)
- Provides: libgtk2-ruby, libgtk2-ruby1.8
- Description: GTK+ bindings for the Ruby language
- GTK+ is a library for creating graphical user interfaces. This package contains libraries for using GTK+ with the Ruby programming language.
- Homepage: http://ruby-gnome2.sourceforge.jp/
- My ruby-poppler:
- Package: ruby-poppler
- New: yes
- State: installed
- Automatically installed: no
- Version: 1.0.0-1
- Priority: optional
- Section: universe/ruby
- Maintainer: Ubuntu Developers <[email protected]>
- Uncompressed Size: 246 k
- Depends: libc6 (>= 2.2.5), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>= 2.8.0), libpoppler-glib6 (>= 0.16), libruby1.8 (>= 1.8.7.352), libruby1.9.1 (>= 1.9.2.290)
- Conflicts: ruby-poppler
- Description: Ruby bindinds for the libpoppler-glib library
- Poppler is a PDF rendering library based on xpdf PDF viewer. This package contains ruby bindings for Poppler.
- Homepage: http://ruby-gnome2.sourceforge.jp/
- Any insight about this and how it could be solved?
- Yours sincerely
- ChloeD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement