From: SourceForge.net <no...@so...> - 2011-12-25 09:15:31
|
Bugs item #3350148, was opened at 2011-07-02 19:57 Message generated for change (Comment added) made by ktou You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=470969&aid=3350148&group_id=53614 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: unlimited (unlimitedname) Assigned to: Nobody/Anonymous (nobody) Summary: Poppler::IndexIter#child doesn't seem to descend Initial Comment: Hi. I'm rather confused. I looked at the code and what I'm reporting here makes absolutely no sense to me, but I'm doing it anyway, as I believe I have no other option. So, it seems to be impossible to reach any node within the document outline, below the toplevel nodes. This is the code I'm using to test it: <pre> require 'rubygems' require 'poppler' doc = Poppler::Document.new("example.pdf") def print_tree(iter) puts iter.action.title if child = iter.child puts "desc" print_tree(iter) end if iter.next puts "next" print_tree(iter) end end print_tree(doc.index_iter) </pre> My test document (actually mirror.ctan.org/biblio/bibtex/utils/alphabib/example.pdf) has one toplevel node, with several children. The code above though, prints the toplevel node until SystemStackError occurs. The child nodes are never accessed. To verify that my understanding of the Poppler API is correct, I tried the same in python: <pre> import poppler doc = poppler.document_new_from_file("file:///home/nilclass/poppler-bug/example.pdf", "") def print_tree(iter): print iter.get_action().title child = iter.get_child() if(child): print "desc" print_tree(child) if(iter.next()): print "next" print_tree(iter) print_tree(poppler.IndexIter(doc)) </pre> This works as expected, so I believe the error is somewhere within the ruby bindings. Versions: ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux] poppler 0.16.4 (ubuntu packages libpoppler13 and libpoppler-glib6) poppler gem 0.90.9 Anyway, thank's a lot for all the rest of ruby-gnome that works wonderfully :) ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (ktou) Date: 2011-12-25 01:15 Message: It's not a confirmed bug yet. Could you also give us an example PDF? ---------------------------------------------------------------------- Comment By: Skillachie () Date: 2011-12-24 06:33 Message: I am having this problem as well. Is this a confirmed bug ? Tried different iterations of the code below, but was only able to get the main chapters http://stackoverflow.com/questions/8484426/ruby-poppler-pdf-table-of-contents-index ---------------------------------------------------------------------- Comment By: Kouhei Sutou (ktou) Date: 2011-07-02 20:58 Message: Could you give us an example PDF? ---------------------------------------------------------------------- Comment By: unlimited (unlimitedname) Date: 2011-07-02 20:00 Message: this is bullshit. I had an obvious error in my code, so here's the new version: require 'rubygems' require 'poppler' doc = Poppler::Document.new("example.pdf") def print_tree(iter) puts iter.action.title if iter.action if child = iter.child puts "desc" print_tree(child) end if iter.next puts "next" print_tree(iter) end end print_tree(doc.index_iter) The error described above was obviously an error in my code, but what I'm experiencing now is, that within all second-level nodes the "action" method returns nil (hence the added check). All nodes are visited ("desc"/"next" printed as expected), though the action is empty. Needless to say - I'm even more confused than before. Sorry for the mess. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=470969&aid=3350148&group_id=53614 |