Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[ENH]: Better URL support for PDF backend #23152

Copy link
Copy link
Open
@oscargus

Description

@oscargus
Issue body actions

Problem

The SVG backend supports URLs for all objects, which is quite easy as the URL is connected to the object in SVG (if I understand things correctly).

The PDF backend supports URLs for texts, but not for any other objects. One problem here is that the link seems to be connected to an area rather than an object.

It should be reasonably feasible to add support for images, markers, and bars.

Proposed solution

This is the code for adding an URL to a text object:

if gc.get_url() is not None:
link_annotation = {
'Type': Name('Annot'),
'Subtype': Name('Link'),
'Rect': (x, y, x + width, y + height),
'Border': [0, 0, 0],
'A': {
'S': Name('URI'),
'URI': gc.get_url(),
},
}
self.file._annotations[-1][1].append(link_annotation)

Basically, if one knows the coordinates, it should just be to copy this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.