Skip to content

Instantly share code, notes, and snippets.

@oxplot
Last active November 25, 2022 11:27
Show Gist options
  • Save oxplot/4b5ded9875cbba3e514f to your computer and use it in GitHub Desktop.
Save oxplot/4b5ded9875cbba3e514f to your computer and use it in GitHub Desktop.
Add hyperlinks to PDFs created by Inkscape
@oxplot
Copy link
Author

oxplot commented Nov 24, 2022

I'd be happy to supply files generated by me to test with but I'm not sure how to attach them here.

Yep, please do. You can upload your file here for e.g.: https://www.file.io/

@oxplot
Copy link
Author

oxplot commented Nov 24, 2022

Meanwhile, make sure you have your version of qpdf is not too far off of 11.1.1. Similarly, my Inkscape is at version Inkscape 1.2.1 (there seems to be a bunch of fixes for PDF export in 1.2.1 release).

@Gaibhne
Copy link

Gaibhne commented Nov 24, 2022

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
Copy link
Author

oxplot commented Nov 24, 2022

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

@Gaibhne
Copy link

Gaibhne commented Nov 24, 2022

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

@oxplot
Copy link
Author

oxplot commented Nov 24, 2022

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
Copy link

Gaibhne commented Nov 25, 2022

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
Copy link
Author

oxplot commented Nov 25, 2022

@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