oxplot / gists Goto Github PK
View Code? Open in Web Editor NEWCodes that don't deserve their own repo (yet).
Codes that don't deserve their own repo (yet).
Proposed command line usage:
svglinkify input.svg output.pdf [--pdf-version pdf-version]
svglinkify
should inspect the SVG, add visual markers to all components with hyperlinks, export to PDF, add links to PDF and write it out.
--pdf-version
is equivalent to inkscape
's --export-pdf-version
command line arg.
I understand this is a big hack, but really appreciate you came up with this piece of code.
I don't know the internals of how Inkscape (using lib cairo?) converts SVGs to PDF but it seems like the technique you have to use for this to work only works for me if I have text that has a white rectangle behind it. Other areas I would want to create links in are in front of a rectangle with black background and others are in front of a rectangle with a semi-transparent pattern as a fill.
Any insight into how this could be affecting the code and the workaround? I followed instructions to the tee regarding moving the rectangles around and grouping,etc. Also, the fact that I got some links to work, and all of them being on top of a white rectangle leads me to believe there is a connection with that.
I've looked at the code heavily and the main regex which grabs links from combinations doesn't seem like it would mind if there are other rectangles that don't match this pattern somewhere 'above' or 'below' the ones that do. Maybe move things to another layer?
I am willing to help debug this as the tool helped me out tremendously but would be even more useful if it doesn't have these current limitations.
Using svglinkify.py with the version of Inkscape (0.92.3-1) + dependencies (likely most importantly libpoppler 0.62) distributed in Ubuntu 18.04 results in a pdf with no clickable links.
svglinkify.py runs without reporting errors. If I add a print statement showing the rectangles, it seem to find them ok. Still, the generated output just misses the clickable links. However, if I keep everything the same, still running svglinkify.py on Ubuntu 18.04, but, I use a pdf file generated from Inkspace + dependencies running on Ubuntu 17.10, the links show up as desired.
Downgrading Inkscape itself to the exact version from Ubuntu 17.10 (0.92.2-1build1) did not resolve the issue. Hence, I suspect it is a change that has happened between libpoppler68 (v 0.57) and libpoppler73 (v 0.62).
A workaround is to generate the pdf used for svglinkify using the inkscape version in the snap store instead, i.e., install it with;
sudo snap install inkscape
and run it with:
snap run inkscape
This version uses libpoppler58 (v 0.41) and everything seems to be working with this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.