<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Cannot obtain linkmapping information in python/gjs"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=104718">104718</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Cannot obtain linkmapping information in python/gjs
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>poppler
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>glib frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>poppler-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>m.duell@gmx.de
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=136883" name="attach_136883" title="Python Code">attachment 136883</a> <a href="attachment.cgi?id=136883&action=edit" title="Python Code">[details]</a></span>
Python Code

Cannot obtain information about hyperlinks on the current page using python. 

This might also be a problem with the GLib bindings. The problem appears also
using gjs bindings (will not post here unless specifically required), but with
C and vala it appears to work correctly.

I attach a test pdf, generated using latex with a few hyperlinks and
inner-document links.

With the attached vala code, I get the following output.


$ ./mini_linkmap
gotodest: 5
link: area: 158.232000 321.926000 290.983000 333.051000
link: 5 t: (null) u: <a href="https://gitlab.gnome.org/GNOME/pygobject">https://gitlab.gnome.org/GNOME/pygobject</a>
link: area: 398.028000 333.605000 478.476000 345.560000
link: 5 t: (null) u: <a href="https://gitlab.gnome.org/GNOME/pygobject">https://gitlab.gnome.org/GNOME/pygobject</a>
link: area: 258.578000 353.530000 427.942000 365.485000
link: 5 t: (null) u: <a href="https://poppler.freedesktop.org/">https://poppler.freedesktop.org/</a>
link: area: 132.772000 408.573000 218.450000 419.698000
link: 5 t: (null) u: <a href="https://poppler.freedesktop.org/">https://poppler.freedesktop.org/</a>
link: area: 392.798000 420.529000 478.476000 431.653000
link: 5 t: (null) u: <a href="https://poppler.freedesktop.org/">https://poppler.freedesktop.org/</a>
link: area: 435.948000 446.653000 442.922000 455.066000
   dest type 2 page 0 a: 0.000000 0.000000 0.000000 0.000000 z: 0.000000 n:
cite.Random 
link: area: 383.416000 511.438000 390.390000 522.286000
   dest type 2 page 0 a: 0.000000 0.000000 0.000000 0.000000 z: 0.000000 n:
section.1 


The python code should give a similar output. However, The URI strings are
returned empty.

$ ./mini_linkmap.py crash2
link: area: 158.232000 321.926000 158.232000 333.051000
action type: uri
title: None
uri: ''
link: area: 398.028000 333.605000 398.028000 345.560000
action type: uri
title: None
uri: ''
link: area: 258.578000 353.530000 258.578000 365.485000
action type: uri
title: None
uri: ''
link: area: 132.772000 408.573000 132.772000 419.698000
action type: uri
title: None
uri: ''
link: area: 392.798000 420.529000 392.798000 431.653000
action type: uri
title: None
uri: ''
link: area: 435.948000 446.653000 435.948000 455.066000
action type: 2 goto_dest page 0 a: (0.0, 0.0, 0.0, 0.0) z: 0.0 dest type: <enum
31335872 of type Poppler.DestType>
link: area: 383.416000 511.438000 383.416000 522.286000
action type: 2 goto_dest page 0 a: (0.0, 0.0, 0.0, 0.0) z: 0.0 dest type: <enum
31337472 of type Poppler.DestType>




If the goto_dest named_dest string is queried, even the python interpreter
crashes most times and sometimes yields garbage.

$ ./mini_linkmap.py crash
link: area: 158.232000 321.926000 158.232000 333.051000
action type: uri
link: area: 398.028000 333.605000 398.028000 345.560000
action type: uri
link: area: 258.578000 353.530000 258.578000 365.485000
action type: uri
link: area: 132.772000 408.573000 132.772000 419.698000
action type: uri
link: area: 392.798000 420.529000 392.798000 431.653000
action type: uri
link: area: 435.948000 446.653000 435.948000 455.066000
action type: 2 goto_dest page 0 a: (0.0, 0.0, 0.0, 0.0) z: 0.0 dest type: <enum
28583360 of type Poppler.DestType>
**
ERROR:../../gi/pygi-argument.c:1004:_pygi_argument_to_object: code should not
be reached
Aborted

Example of random garbage:

$ ./mini_linkmap.py crash
link: area: 158.232000 321.926000 158.232000 333.051000
action type: uri
link: area: 398.028000 333.605000 398.028000 345.560000
action type: uri
link: area: 258.578000 353.530000 258.578000 365.485000
action type: uri
link: area: 132.772000 408.573000 132.772000 419.698000
action type: uri
link: area: 392.798000 420.529000 392.798000 431.653000
action type: uri
link: area: 435.948000 446.653000 435.948000 455.066000
action type: 2 goto_dest page 0 a: (0.0, 0.0, 0.0, 0.0) z: 0.0 dest type: <enum
24778176 of type Poppler.DestType>
title: None n: 0ƈ
link: area: 383.416000 511.438000 383.416000 522.286000
action type: 2 goto_dest page 0 a: (0.0, 0.0, 0.0, 0.0) z: 0.0 dest type: <enum
24779840 of type Poppler.DestType>
title: None n: 0ƈ</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>