I am making a figure for a scientific paper and I have a "main"Â svg file for the figure, in which i have linked several "secondary" svgs that contain the different plots of the figure. If I open the "main" svg in a browser, the "secondary" ones appear as vector graphics (I can zoom and the quality is always good). With google chrome, I can export the "main" svg to pdf, and it is also exported as vector graphics. I would like to export the "main" svg to pdf with inkscape. However, when I export it to pdf, all the "secondary" svgs are rasterised, but text from the "main" svg is exported as vector graphics.
Is there a known way to export linked/embedded images to pdf without rasterising?
Hi @inklinea thank you so much for the swift answer, that worked for me! I guess next step is figuring out the options for printing only the desired region instead of printing to an A4, thanks for putting me on the right track! I will paste the solution when I find it.
Hey thanks for the followup. I had to go a bit more into it to get exactly what I wanted (pdf to have the exact size as the svg). I only managed to do it with some css and javascript, but does the trick! I made a repository for it, in case someone comes with this exact need:
@iklinea thank you for suggesting chrome workaround, I've tested it with chromium and it solves this issue, but introduces plenty new ones, mostly size of canvas - my svg document had specific page size, which chromium tries to fit into A4 by default. @manulera solution is too cumbersome for me, it seems to require knowing size of the document ahead of time (which is hard with many SVGs with varying sizes).
I will try to submit a feature request to properly support svg links when exporting them to PDFs.
It suggests adding a command line option (which I agree would be useful when converting multiple .svg files), but I think that having this exposed in .pdf dialog would also be useful.
I'm surprised they are not embedded by default though.
I am making a figure for a scientific paper and I have a "main"Â svg file for the figure, in which i have linked several "secondary" svgs that contain the different plots of the figure. If I open the "main" svg in a browser, the "secondary" ones appear as vector graphics (I can zoom and the quality is always good). With google chrome, I can export the "main" svg to pdf, and it is also exported as vector graphics.
I would like to export the "main" svg to pdf with inkscape. However, when I export it to pdf, all the "secondary" svgs are rasterised, but text from the "main" svg is exported as vector graphics.
Is there a known way to export linked/embedded images to pdf without rasterising?
Thanks!
If you have chrome in your path, then this does convert to from svg to pdf. It might do what you want.
If you are on windows.
I've uploaded a couple of images web.svg, and pattern.svg. pattern.svg contains web.svg in a <use> element as an external asset
https://www.raincloud.co.uk/junk/web.svg
https://www.raincloud.co.uk/junk/pattern.svg
chrome --headless --disable-gpu --print-to-pdf="C:\Users\YOURUSERNAME\Documents\pdf_output.pdf" https://www.raincloud.co.uk/junk/pattern.svg
You do have to have the full path for the output file in quotes.
Hi @inklinea thank you so much for the swift answer, that worked for me! I guess next step is figuring out the options for printing only the desired region instead of printing to an A4, thanks for putting me on the right track! I will paste the solution when I find it.
chrome --headless --disable-gpu --print-to-pdf-no-header --print-to-pdf="C:\Users\YOURUSERNAME\Documents\pdf_output2.pdf" https://www.raincloud.co.uk/junk/pattern.svg
Same thing but without the header and footer ( just the plain svg )
https://developers.google.com/web/updates/2017/04/headless-chrome
Hey thanks for the followup. I had to go a bit more into it to get exactly what I wanted (pdf to have the exact size as the svg). I only managed to do it with some css and javascript, but does the trick! I made a repository for it, in case someone comes with this exact need:
https://github.com/manulera/printSvg2Pdf
Â
@iklinea thank you for suggesting chrome workaround, I've tested it with chromium and it solves this issue, but introduces plenty new ones, mostly size of canvas - my svg document had specific page size, which chromium tries to fit into A4 by default. @manulera solution is too cumbersome for me, it seems to require knowing size of the document ahead of time (which is hard with many SVGs with varying sizes).
I will try to submit a feature request to properly support svg links when exporting them to PDFs.
There is already a very similar feature request opened 3 years ago:
https://gitlab.com/inkscape/inbox/-/issues/3165
It suggests adding a command line option (which I agree would be useful when converting multiple .svg files), but I think that having this exposed in .pdf dialog would also be useful.
I'm surprised they are not embedded by default though.