0

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 Answers1

1

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.

Community
  • 1
  • 1
Paul LeBeau
  • 97,474
  • 9
  • 154
  • 181
  • Hi, Paul. No, unfortunately I will need to convert it back to PDF... When I open PDF with foreignObject in Inkscape it just doesn't render it. What I need is to create SVG which I could convert back to PDF. – Andrew Zolotukhin Sep 27 '19 at 21:19
  • Ok. I would suggest trying some other vector editors. To see if any of them will convert the PDF to SVG successfully. – Paul LeBeau Sep 27 '19 at 21:47
  • That's actually what my question is about. Unfortunately I didn't find any vector editor that could covert PDF/EPS to SVG maintaining CMYK colors. That's why I decided to ask community about that. – Andrew Zolotukhin Sep 29 '19 at 08:00
  • If you're using SVG only as a means to another pdf, why use it at all? You could stay in CMYK if you use Scribus, for example. – Moini Sep 29 '19 at 21:54