zhw created FOP-2932:
------------------------

             Summary: SVG to EPS
                 Key: FOP-2932
                 URL: https://issues.apache.org/jira/browse/FOP-2932
             Project: FOP
          Issue Type: Bug
          Components: renderer/ps
         Environment: linux 
            Reporter: zhw
         Attachments: c.svg, image-2020-04-20-18-46-35-831.png, 
image-2020-04-20-18-47-10-582.png, svgToEpsFile.eps

I tried to convert SVG to EPS. Although it was successful, the content of EPS 
file converted was incorrect, and the rendering of original SVG file was lost. 
I was very surprised why the color of EPS file generated was lost。

version:
{code:java}
<dependency>
    <groupId>org.apache.xmlgraphics</groupId>
    <artifactId>fop</artifactId>
    <version>2.4</version>
</dependency>



<dependency>
    <groupId>org.apache.xmlgraphics</groupId>
    <artifactId>batik-all</artifactId>
    <version>1.12</version>
    <type>pom</type>
</dependency>
{code}
{code:java}
public void svgtoeps(String svgCode, OutputStream os){
    EPSTranscoder epsTranscoder = new EPSTranscoder();
    try {
        svgCode = svgCode.replaceAll(":rect", "rect");
        TranscoderInput input = new TranscoderInput(new 
ByteArrayInputStream(svgCode.getBytes()));
        TranscoderOutput output = new TranscoderOutput(os);
        epsTranscoder.transcode(input, output);
        os.flush();
        os.close();
    } catch (Exception e) {
    }
}
{code}
svg:
{code:java}
<svg xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 1034.7 
791.52"><defs><radialGradient id="a88099553-ad5b-4e3d-9162-06592b3c5c3a" 
cx="521.08" cy="461.4" r="330.12" gradientUnits="userSpaceOnUse"><stop 
offset="0" stop-color="#e35f67"/><stop offset="1" 
stop-color="#a6222b"/></radialGradient></defs><g><g><path d="M57.24 
464.41l155.71 127c31.62 25.78 57.24 3.65 
57.24-49.43V280.52c0-53.08-25.63-117-57.24-142.79L57.24 10.76C25.63-15 0 7.11 0 
60.19v261.43c0 53.08 25.63 117.01 57.24 142.79zM977.45 464.41l-155.71 
127c-31.62 25.78-57.24 3.65-57.24-49.43V280.52c0-53.08 25.63-117 
57.24-142.79l155.71-127c31.62-25.78 57.24-3.65 57.24 49.43v261.46c.01 
53.08-25.62 117.01-57.24 142.79z" fill="#cfd4d5"/><rect x="190.96" y="131.28" 
width="660.23" height="660.23" rx="207.26" ry="207.26" 
fill="url(#a88099553-ad5b-4e3d-9162-06592b3c5c3a)"/><path d="M619.78 
319.62a114.15 114.15 0 0 0-98.7 56.72 114.21 114.21 0 0 0-212.9 57.48c0 119.3 
212.9 210.66 212.9 210.66S734 540.06 734 433.82a114.2 114.2 0 0 
0-114.22-114.2z" fill="#fff"/></g></g></svg>
{code}
 svg: !image-2020-04-20-18-46-35-831.png|width=284,height=215!  

 

eps:

!image-2020-04-20-18-47-10-582.png|width=253,height=190!
 
Please help me,thank you



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to