Latest Inkscape version has this functionality built-in now - except for internal links. For that, see https://github.com/oxplot/svglinkify
-
-
Save oxplot/4b5ded9875cbba3e514f to your computer and use it in GitHub Desktop.
Debugging shows that after # Load object IDs of all pages in the PDF document.
, only a single ID is found (earlier, under # Get pages and convert all measurements to pixels.
all pages are correctly detected). The QDF output also shows only a single /Page
, which I do not understand, especially not why it would work for you and not me. Inkscape Save Copy As
correctly produces a multi-page-pdf. I'd be happy to supply files generated by me to test with but I'm not sure how to attach them here.
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/
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).
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'
Thanks for that. Was handling the px
unit for the document size incorrectly. Just pushed a commit which works with your example file.
It did, thank you again! Do you have one of those 'buy a developer a beer' kind of things ?
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. :)
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.
@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.
Addendum: links are added correctly, but internal links to other pages don't work, because the objects presumably get optimized away due to not being on any page. Internal links to same-page elements produce a clickable link which work correctly (zooming in and clicking scrolls you to the target element). External links also work.