Skip to content

Instantly share code, notes, and snippets.

@oxplot
Last active February 3, 2025 21:38
Show Gist options
  • Select an option

  • Save oxplot/4b5ded9875cbba3e514f to your computer and use it in GitHub Desktop.

Select an option

Save oxplot/4b5ded9875cbba3e514f to your computer and use it in GitHub Desktop.
Add hyperlinks to PDFs created by Inkscape
@Gaibhne

Gaibhne commented Nov 24, 2022

Copy link
Copy Markdown

Oh God, I hope you didn't waste too much time on this yet. I just tested, and I did in fact have a broken Inkscape version because my upstream hadn't added the newest one yet. I got it working (although I have a file that I can't get working even after deleting every single thing in it, which I'll attach in case it's something obvious). But following your demo works perfectly for me now, so thanks!

Broken file: https://file.io/TF3IUwiLb3H1 - it's just three blank pages now, I've removed everything, but something makes the script error out with:

Traceback (most recent call last):
  File "/home/stoever/svglinkify-new/svglinkify.py", line 340, in <module>
    main()
  File "/home/stoever/svglinkify-new/svglinkify.py", line 70, in main
    svg_width_pixels = unit_2_px[svg_width[-2:]] * float(svg_width[:-2])
KeyError: '04'

@oxplot

oxplot commented Nov 24, 2022

Copy link
Copy Markdown
Author

Thanks for that. Was handling the px unit for the document size incorrectly. Just pushed a commit which works with your example file.

@Gaibhne

Gaibhne commented Nov 24, 2022

Copy link
Copy Markdown

It did, thank you again! Do you have one of those 'buy a developer a beer' kind of things ?

@oxplot

oxplot commented Nov 24, 2022

Copy link
Copy Markdown
Author

It did, thank you again! Do you have one of those 'buy a developer a beer' kind of things ?

Great. You're welcome - it was fun. I added some sponsor links to the svglinkify project page. :)

@Gaibhne

Gaibhne commented Nov 25, 2022

Copy link
Copy Markdown

I tried them all, and they are all too unconfigured to do anything :D Ko-Fi for example says "Oops, that didn't work! This creator cannot receive PayPal payments at this time.", and the others are all similar messages.

@oxplot

oxplot commented Nov 25, 2022

Copy link
Copy Markdown
Author

@Gaibhne whoops I should probably set them up 😄

EDIT: OMG, the payment part is a PITA — I guess I'm content with gratitude alone. Thanks anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment