0
votes

I have a SVG document (let's name it img1.svg) and PDF file ( doc1.pdf) consisting of 1 page. What I need is to insert (scale, rotate and place at some point in the document) doc1.pdf into img1.svg. In order to achieve it I have to convert doc1.pdf to doc1.svg (it can be easily done by inkscape) and then I can just insert contents of doc1.svg into img1.svg, that's easy.

But what if doc1.pdf contain some elements with CMYK color space? In this case inkscape doesn't produce correct version of doc1.svg. It creates correct layout, but colors are in RGB now. I know that there is a possibility to use CMYK colors in SVG2 specification and inkscape imports correctly SVG2 files with elements having CMYK colors.

My question is are there any software which allow converting PDF files to SVG2 (maintaining CMYK color space)?

I've tried to do it with inkscape and scribus but always got RGB output.

1

1 Answers

1
votes

Are your SVGs always going to be displayed in a browser? If so, you have the option of using a <foreignObject> element to display the PDF inside the SVG.

<svg width="400" viewBox="0 0 400 400">

  <foreignObject x="50" y="50" width="300" height="300">
    <body xmlns="http://www.w3.org/1999/xhtml">
      <object type="application/pdf"
        data="sample.pdf" width="300" height="300"></object>
    </body>
  </foreignObject>
  
</svg>

Update

Sorry, I didn't read your question properly.

I know that there is a possibility to use CMYK colors in SVG2 specification

What are you referring to here? The SVG 2 specification defers all matter of colours to the CSS3 specification "or its successor". The CSS3 spec has no support for CMYK colours. The still-in-development CSS4 spec, however, has added a new colour function: device-cmyk(). However no browsers support that yet AFAIK.

You may be referring to the icc-color() function that was deprecated in SVG 1.1. And has since been dropped from the SVG2 specification.

I'm only aware of one piece of software that supported icc-color() and that is RenderX. See:

how can i use cmyk in an svg embeded in html?

But there may be other software in the print industry space.

My question is are there any software which allow converting PDF files to SVG2 (maintaining CMYK color space)?

Given the above, I would search among the software developed specifically for the print industry (if you haven't already). Stack Overflow is probably not the best place.

Also, have you tried asking in the Graphich Design Stack Exchange?

Good luck with your search.