Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add hyperlinks to PDFs created by Inkscape
#
# Moved to https://github.com/oxplot/gists/blob/master/svglinkify.py
#
@psychoticbeef

This comment has been minimized.

Show comment
Hide comment
@psychoticbeef

psychoticbeef May 6, 2015

Very nice, thank you. Having trouble with one thing: After joining multiple pdfs with pdfjoin the links are gone. Any idea why?

Very nice, thank you. Having trouble with one thing: After joining multiple pdfs with pdfjoin the links are gone. Any idea why?

@oxplot

This comment has been minimized.

Show comment
Hide comment
@oxplot

oxplot May 19, 2015

Hmm, that's odd. Mind emailing me the source SVGs?

Owner

oxplot commented May 19, 2015

Hmm, that's odd. Mind emailing me the source SVGs?

@tenoritaiga

This comment has been minimized.

Show comment
Hide comment
@tenoritaiga

tenoritaiga May 31, 2015

This is exactly what I was looking for, and saved me a huge headache. Thank you very much for this script.

This is exactly what I was looking for, and saved me a huge headache. Thank you very much for this script.

@pszafer

This comment has been minimized.

Show comment
Hide comment
@pszafer

pszafer Jun 9, 2015

Hello,
I have svg and pdf. SVG is bit complicated, with few layers etc.
But from svg your script returning 1 rectangle with link and for created pdf, qpdf is returning 0 rectangles then I've got message about diffs between svg and pdf.
Am I creating pdf in wrong way or how should I do it to work? :)
Thanks for your script and help!

pszafer commented Jun 9, 2015

Hello,
I have svg and pdf. SVG is bit complicated, with few layers etc.
But from svg your script returning 1 rectangle with link and for created pdf, qpdf is returning 0 rectangles then I've got message about diffs between svg and pdf.
Am I creating pdf in wrong way or how should I do it to work? :)
Thanks for your script and help!

@oxplot

This comment has been minimized.

Show comment
Hide comment
@oxplot

oxplot Jun 9, 2015

It's most likely the "SVG [being] complicated" that's causing you problems. Like I've mentioned in the instructions, the script only works if you've drawn the magenta rectangles with no transformations of any kind. Send me a copy of your SVG if you can, and I might be able to help you further.

Owner

oxplot commented Jun 9, 2015

It's most likely the "SVG [being] complicated" that's causing you problems. Like I've mentioned in the instructions, the script only works if you've drawn the magenta rectangles with no transformations of any kind. Send me a copy of your SVG if you can, and I might be able to help you further.

@oxplot

This comment has been minimized.

Show comment
Hide comment
@oxplot

oxplot Jun 10, 2015

OK. Here's what I did. I added a new layer and called it "Links" and put it at the bottom. Drew the magenta box over the email address and the website address, and followed the rest of the instructions as described and it works fine. If you want the modified SVG and the resulting PDF, send me an email (it's at the top of the script) and I'll reply with the files.

Owner

oxplot commented Jun 10, 2015

OK. Here's what I did. I added a new layer and called it "Links" and put it at the bottom. Drew the magenta box over the email address and the website address, and followed the rest of the instructions as described and it works fine. If you want the modified SVG and the resulting PDF, send me an email (it's at the top of the script) and I'll reply with the files.

@pszafer

This comment has been minimized.

Show comment
Hide comment
@pszafer

pszafer Jun 10, 2015

I send e-mail :)
Cool that it is working, hopefully it will work for me too.

pszafer commented Jun 10, 2015

I send e-mail :)
Cool that it is working, hopefully it will work for me too.

@BerserkWolfS

This comment has been minimized.

Show comment
Hide comment
@BerserkWolfS

BerserkWolfS Nov 24, 2015

Thank you very much, you made my day ! Your script is just awesome. It was the last tool I needed to make my presentations completely with Inkscape. Great job !

Thank you very much, you made my day ! Your script is just awesome. It was the last tool I needed to make my presentations completely with Inkscape. Great job !

@itskathylam

This comment has been minimized.

Show comment
Hide comment
@itskathylam

itskathylam Feb 4, 2016

Thanks for this!

Thanks for this!

@hcommenges

This comment has been minimized.

Show comment
Hide comment
@hcommenges

hcommenges Feb 7, 2016

I've a problem with your script: it works well for one hyperlink, but it fails when I try to create multiple links/boxes in the same svg file and I get the error message "error: found diff # of rects in svg & ps...". Do you have any idea why it could happen? Thanks!

I've a problem with your script: it works well for one hyperlink, but it fails when I try to create multiple links/boxes in the same svg file and I get the error message "error: found diff # of rects in svg & ps...". Do you have any idea why it could happen? Thanks!

@oxplot

This comment has been minimized.

Show comment
Hide comment
@Steven-P

This comment has been minimized.

Show comment
Hide comment
@Steven-P

Steven-P Sep 27, 2016

hcommenges, I found that creating a new layer for EACH rectangle was required. Also make sure that each of these layers is under the layer that contains the text blocks you want to link. I spent an hour on that today and that was what made it work for me.

oxplot, THANK YOU VERY MUCH!

hcommenges, I found that creating a new layer for EACH rectangle was required. Also make sure that each of these layers is under the layer that contains the text blocks you want to link. I spent an hour on that today and that was what made it work for me.

oxplot, THANK YOU VERY MUCH!

@thomasoliveira

This comment has been minimized.

Show comment
Hide comment
@thomasoliveira

thomasoliveira Nov 24, 2016

Wonderful! Thanks!
Just a suggestion on the instructions: after adding the box with the link to the SVG file, it is not enough to export it as PDF. One has also to save the SVG. Could you please explicitly add this instruction to the top of the script, please?

Wonderful! Thanks!
Just a suggestion on the instructions: after adding the box with the link to the SVG file, it is not enough to export it as PDF. One has also to save the SVG. Could you please explicitly add this instruction to the top of the script, please?

@orlandotrejo

This comment has been minimized.

Show comment
Hide comment
@orlandotrejo

orlandotrejo May 9, 2017

It works, thanks !

It works, thanks !

@Avibes

This comment has been minimized.

Show comment
Hide comment
@Avibes

Avibes Mar 20, 2018

Hi there!

First of all, thanks for your labor.

I cant run the code, may you can help me. I follow the spets mentioned and download the qpdf tool.

Maybe my problem is in the qpdf part. I am working with windows, and I placed the qpdf files in C:.

Well, when I try to run the script I have the following error:
image

Avibes commented Mar 20, 2018

Hi there!

First of all, thanks for your labor.

I cant run the code, may you can help me. I follow the spets mentioned and download the qpdf tool.

Maybe my problem is in the qpdf part. I am working with windows, and I placed the qpdf files in C:.

Well, when I try to run the script I have the following error:
image

@ALFREDOEN

This comment has been minimized.

Show comment
Hide comment
@ALFREDOEN

ALFREDOEN Apr 7, 2018

Hi! For me, it says that svglinkify.py could not open cause its damaged or not supported. How do I fix that?

Hi! For me, it says that svglinkify.py could not open cause its damaged or not supported. How do I fix that?

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