Author Topic: Include a link to a pdf- or svg-file inside an Inkscape svg instead of embedding  (Read 2805 times)

March 02, 2018, 07:02:04 AM
Read 2805 times

cheflo

  • Sr. Newbie

  • Offline
  • **

  • 3
Hi,
I am using python to create a bunch of plots of my data and then Inkscape to layout individual plots and schematics within 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 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

Code: [Select]
    <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 saying that the file cannot be rendered. 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, or alternatively being exported as vector files even if they render as rasters?
  • 0.92
  • Linux

March 03, 2018, 12:15:11 PM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

This question is probably outside of my wheelhouse, so to speak.  And I might not even understand what you're asking.  But I'll try.  (And others who probably will understand better, will be along to correct me, haha.)

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 in this manner in Adobe Illustrator .ai-files, and I wonder if there is any way to do it in Inkscape as well?

I'm not sure if you need to link SVG into Inkscape, since Inkscape's native format is SVG.  To be able to use SVG instead of high dpi raster images, the raster images would need to be converted to vector.  If you can show us an example of one of the raster images, we can give you suggestions to help decide which way to convert.

Or as I said, it's possible that some combination of formats would work better, and someone else will have to comment on that part.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

March 03, 2018, 12:53:54 PM
Reply #2

cheflo

  • Sr. Newbie

  • Offline
  • **

  • 3
Thanks for the reply brynn and sorry for not being clear in my initial post, I will try again:

Say I create a few plots in Python and save them as .svg or .pdf. Now I want to use inkscape to layout these figures and add some text to make a poster for presentation purposes. The reason I want to link the figures instead of embedding them, is that if I need to change something in the figures via the Python code, I want the rendition of the figure in inkscape to update automatically instead of me manually pasting/embedding the new figure.

Basically, I want Inkscape to reserve a given space for each of the plots, and just render the latest version of the linked file within that area. I want it to render (or at least export) at full resolution since I print these as large posters and raster images end up looking pixelated (unless I have really high DPI, in which case the file size gets quite big).

Let me know if it is still unclear what I want and thanks for helping!
  • 0.92
  • Linux

March 03, 2018, 01:14:41 PM
Reply #3

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Ok, I understand that better.  Unfortunately I don't know the answer.  But someone else should be along before too long, who does know the answer.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

March 03, 2018, 01:22:58 PM
Reply #4

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
I have seen that it is possible to include pdfs in this manner in Adobe Illustrator .ai-files, and I wonder if there is any way to do it in Inkscape as well?

Yes, this is possible:
https://stackoverflow.com/questions/5451135/embed-svg-in-svg

March 03, 2018, 03:10:50 PM
Reply #5

cheflo

  • Sr. Newbie

  • Offline
  • **

  • 3
Thanks for the reply Moini,

The top answer in the question you linked is the method that I mention in my question. When I tried this, inkscape rendered and exported the linked svg as a low resolution raster image. Did you try this and managed to export in full resolution? If so, how did you do it?
  • 0.92
  • Linux

March 04, 2018, 04:57:10 AM
Reply #6

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Aaaaah. I'd try to change the import resolution in the settings (Edit > Preferences > Bitmaps > Import resolution). Don't have time to test it now, but I suspect it might work. Maybe it's not going to be vector in an exported pdf, but you might get a sufficient resolution, so nobody will notice.

March 04, 2018, 04:58:39 AM
Reply #7

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
... or it might be the default export resolution. Please report what/if any of it worked!

August 13, 2018, 02:14:53 PM
Reply #8

SomeBody

  • Newbie

  • Offline
  • *

  • 1
I'm going to necro this with an answer:

None of it works. In proof that the universe is full of absurdity, Inkscape refuses to work with its own native format and instead insists on converting linked SVGs into the absolute worst quality bitmaps possible.

In proof that the Inkscape devs are full of absurdity, people have been asking for vector imports since at least 2012.

Like OP (and many others), I'm trying to use Inkscape to format python-produced plots. Exporting as PDFs and linking those using Adobe Illustrator (as one of my lab mates does) seemed like a silly exercise. But I guess it's the best that we're going to get, since Inkscape simply isn't fit for purpose.
  • 0.92
  • Windows

August 13, 2018, 10:43:45 PM
Reply #9

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Well I still can't offer any suggestions for this, since it's a bit over my head.  I wouldn't mind testing it, and trying Moini's suggestion above, but someone would have to tell me how to link the file.  (I tried using Import to link an SVG file, but Inkscape didn't present me with the choice to link or embed.)

But I can say that Inkscape or the project or the Inkscape community does not develop SVG.  It uses SVG according to the SVG standards.  Are you saying that this technique works in SVG files that are not created with Inkscape?  Or does it not work in any SVG file?  I don't know, I'm just asking.

Well, in any case, the best way to get new features, or get broken features fixed is to report them in the bug tracker (which currently is Launcpad, but may move in the near future).  Also, Inkscape developers won't see your comments here.  Here is some info about contacting developers and reporting bugs and requesting new features.  https://forum.inkscapecommunity.com/index.php?topic=628.0
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

August 14, 2018, 05:40:20 AM
Reply #10

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
This is going to work in Inkscape 1.0, which will even give you an import dialog for SVG files, and ask you whether to link or put into the file. The resolution for displaying the linked SVG file can be set in the preferences in that version.