Is it possible to include a link to a pdf- or svg-file inside an Inkscape svg?
Asked Answered
B

0

6

I am using python to create a bunch of plots of my data and then Inkscape to layout individual plots and schematics in panels of a master figure. I also add some extra elements such as panel names and titles.

Every time I modify something in my Python code, I have to manually paste the svg/pdf plots into Inkscape. I have noticed that if I create the plots as raster images instead of vectors, I can insert a link in the Inkscape document, and have the figure panel update every time I regenerate the plots in python, which is phenomenal!

Currently I am using this approach with a high DPI, but ideally, I would like to insert a link to a svg/pdf file so that the entire figure is a vector instead of a high DPI, big sized raster. I have seen that it is possible to include pdfs (don't think svgs work) in this manner in Adobe Illustrator .ai-files, and I wonder if there is any way to do it in Inkscape as well?

When I insert image links, Inkscape creates a tag in the svg similar to this

<image
   sodipodi:absref="path/to/image.png"
   xlink:href="./image.png"
   y="14.014872"
   x="5.9285898"
   id="image12160"
   preserveAspectRatio="none"
   height="441.91879"
   width="466.55328" />

I can modify the path to point to an svg file, but Inkscape will automatically convert the svg to a low resolution raster. If I change the path to a pdf, I get an error. Is there anything I can modify in the svg-code to be able to link pdf/svg-files and have them render in Inkscape as vector files?

Blackpoll answered 8/5, 2016 at 3:58 Comment(7)
Maybe useful related answer.Gisellegish
Thanks @Juancho, I have tried using the <image> tag, but inkscape converts the linked file to a low resolution bitmap image. I would like the svg/pdf at in vector form, so that I can save it in full resolution.Blackpoll
Latex with tikz would probably be better than a vector graphics software for this.Belle
As explained here, the <image> tag is rendered at a fixed resolution. The <use> tag should do the job.Subsidy
@Subsidy Thanks, I just tried with <use> but it only allows to reference an element within an SVG file, so I can't find a way to include the entire figure (tried referencing the top level element, but it only rendered part of the figure). Do you have suggestions for how to include all elements of an SVG with use (without manually listing all of them)?Blackpoll
Rereading your original question, I believe you are better served by using Scribus instead of Inkscape. With it, you can insert links to PDF files, that are embedded when you export the document to PDF. It also has built-in LaTeX support.Subsidy
For anyone coming across this, it is now possible to link SVG files in inkscape graphicdesign.stackexchange.com/questions/70963/…Blackpoll

© 2022 - 2024 — McMap. All rights reserved.