You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2010/01/19 21:39:41 UTC

DO NOT REPLY [Bug 48575] New: When generating EPS from SVG image content doesn't fit borders

https://issues.apache.org/bugzilla/show_bug.cgi?id=48575

           Summary: When generating EPS from SVG image content doesn't fit
                    borders
           Product: Fop
           Version: 0.95
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ps
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: paul.lysak@gmail.com


org.apache.fop.render.ps.EPSTranscoder produces EPS file from SVG DOM, and
image content doesn't fit image borders (so that picture is croped), though
viewBox parameter in svg file covers all content.

If specify area of interest (by EPSTranscoder.KEY_AOI hint) aproximately 1.38
times larger then actual viewBox then content fit borders well.

Versions 0.93 and 0.94 generate EPS file well, image content fits borders as it
should.

Batik 1.7 was used to create SVG DOM.

Code being used for conversion:

public static byte[] serialize2EPS(Document document){
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     EPSTranscoder tr = new EPSTranscoder();

     try {
         tr.transcode(new TranscoderInput(document),new
TranscoderOutput(baos));
     } catch (TranscoderException e) {        
         e.printStackTrace();
     }       
     return baos.toByteArray();
}

SVG file being processed:

<?xml version="1.0"?>
<svg transform="scale(1.0)" 
width="100.0mm" xmlns:xlink="http://www.w3.org/1999/xlink" height="100.0mm"
viewBox="0.0 0.0 100.0 100.0" xmlns="http://www.w3.org/2000/svg">
<rect fill="#ffffff" x="0" width="100.0" height="100.0" y="0"
style="stroke:#ffffff"/>
<path stroke-linecap="square" fill-opacity="1.0" fill="none"
fill-rule="nonzero" stroke-linejoin="miter" style="stroke:#000" 
d="M48.913043478260875,13.539282990083906 C64.97395582555245,13.539282990083906
77.99389778794813,20.881676490189015 77.99389778794813,29.938977879481314
C77.99389778794813,38.99627926877361 64.97395582555245,46.33867276887872
48.913043478260875,46.33867276887872 C32.852131130969305,46.33867276887872
19.83218916857361,38.99627926877361 19.83218916857361,29.938977879481314
C19.83218916857361,20.881676490189015 32.852131130969305,13.539282990083906
48.913043478260875,13.539282990083906Z"
 stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/>
<path stroke-linecap="square" fill-opacity="1.0" fill="none"
fill-rule="nonzero" stroke-linejoin="miter" style="stroke:#000" 
d="M1.0526315789473684,1.4736842105263157
C1.0526315789473684,1.4736842105263157 98.73684210526316,1.4736842105263157
98.73684210526316,1.4736842105263157 C98.73684210526316,1.4736842105263157
98.73684210526316,98.52631578947368 98.73684210526316,98.52631578947368
C98.73684210526316,98.52631578947368 1.0526315789473684,98.52631578947368
1.0526315789473684,98.52631578947368 C1.0526315789473684,98.52631578947368
1.0526315789473684,1.4736842105263157 1.0526315789473684,1.4736842105263157Z"
stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/><path
stroke-linecap="square" fill-opacity="1.0" fill="none" fill-rule="nonzero"
stroke-linejoin="miter" style="stroke:#000" 
d="M5.684210526315789,5.473684210526316 C5.684210526315789,5.473684210526316
86.52631578947368,90.52631578947368 86.52631578947368,90.52631578947368" 
stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/><path
stroke-linecap="square" fill-opacity="1.0" fill="none" fill-rule="nonzero"
stroke-linejoin="miter" style="stroke:#000" 
d="M6.105263157894737,89.6842105263158 C6.105263157894737,89.6842105263158
93.89473684210526,6.736842105263165 93.89473684210526,6.736842105263165" 
stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/></svg>

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48575] When generating EPS from SVG image content doesn't fit borders

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48575

--- Comment #4 from Paul Lysak <pa...@gmail.com> 2010-01-21 14:31:21 UTC ---
Hi Peter

After some more investigation I've been able to render correct picture and it
looks like the problem was not in FOP itself. I've been using Maven to add FOP
to my project. With this configuration code the picture was wrong:

<dependency>
    <groupId>org.apache.xmlgraphics</groupId>
    <artifactId>fop</artifactId>
    <version>0.95</version>
</dependency>

After your comment I tried to use this configuration code and 

<dependency>
    <groupId>org.apache.xmlgraphics</groupId>
    <artifactId>fop</artifactId>
    <version>0.95-1</version>
</dependency>

Strangle, but they both use the same jar file with FOP. Only difference is that
0.95-1 version (and, by the way, 0.93 and 0.94 versions too) in Maven
repository declares dependencies on both avalon api and avalon impl:
<dependency>
  <groupId>org.apache.avalon.framework</groupId>
  <artifactId>avalon-framework-api</artifactId>
  <version>4.3.1</version>
</dependency>
<dependency>
  <groupId>org.apache.avalon.framework</groupId>
  <artifactId>avalon-framework-impl</artifactId>
  <version>4.3.1</version>
</dependency>

and version 0.95 only declares dependency on avalon api (no dependency on
avalon impl).
But when i've been using version 0.95 there were no complains about missing
classes - picture has rendered, but not correctly. So I wonder: can the
problems with 0.95 be caused by incorrect packaging of some parts of
xmlgraphics - something like old versions of classes which get overriden by
including avalon impl jar? This question is the only remaining issue.

Regards,
Paul.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48575] When generating EPS from SVG image content doesn't fit borders

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48575

--- Comment #2 from Peter Hancock <pe...@gmail.com> 2010-01-20 03:23:32 UTC ---
Created an attachment (id=24864)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24864)
Rendered pdf

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Re: DO NOT REPLY [Bug 48575] New: When generating EPS from SVG image content doesn't fit borders

Posted by Peter Hancock <pe...@gmail.com>.
Hi Paul,

I am a little unclear what the problem is here.  I rendered your svg and
produced the attached eps an pdf to compare.  They both look the same to
me.  Can you elaborate on the problem with reference to my attached images,
please?

Thanks,

Peter

On Tue, Jan 19, 2010 at 8:39 PM, <bu...@apache.org> wrote:

> https://issues.apache.org/bugzilla/show_bug.cgi?id=48575
>
>           Summary: When generating EPS from SVG image content doesn't fit
>                    borders
>           Product: Fop
>           Version: 0.95
>          Platform: PC
>        OS/Version: Linux
>            Status: NEW
>          Severity: normal
>          Priority: P2
>         Component: ps
>        AssignedTo: fop-dev@xmlgraphics.apache.org
>        ReportedBy: paul.lysak@gmail.com
>
>
> org.apache.fop.render.ps.EPSTranscoder produces EPS file from SVG DOM, and
> image content doesn't fit image borders (so that picture is croped), though
> viewBox parameter in svg file covers all content.
>
> If specify area of interest (by EPSTranscoder.KEY_AOI hint) aproximately
> 1.38
> times larger then actual viewBox then content fit borders well.
>
> Versions 0.93 and 0.94 generate EPS file well, image content fits borders
> as it
> should.
>
> Batik 1.7 was used to create SVG DOM.
>
> Code being used for conversion:
>
> public static byte[] serialize2EPS(Document document){
>     ByteArrayOutputStream baos = new ByteArrayOutputStream();
>     EPSTranscoder tr = new EPSTranscoder();
>
>     try {
>         tr.transcode(new TranscoderInput(document),new
> TranscoderOutput(baos));
>     } catch (TranscoderException e) {
>         e.printStackTrace();
>     }
>     return baos.toByteArray();
> }
>
> SVG file being processed:
>
> <?xml version="1.0"?>
> <svg transform="scale(1.0)"
> width="100.0mm" xmlns:xlink="http://www.w3.org/1999/xlink"
> height="100.0mm"
> viewBox="0.0 0.0 100.0 100.0" xmlns="http://www.w3.org/2000/svg">
> <rect fill="#ffffff" x="0" width="100.0" height="100.0" y="0"
> style="stroke:#ffffff"/>
> <path stroke-linecap="square" fill-opacity="1.0" fill="none"
> fill-rule="nonzero" stroke-linejoin="miter" style="stroke:#000"
> d="M48.913043478260875,13.539282990083906
> C64.97395582555245,13.539282990083906
> 77.99389778794813,20.881676490189015 77.99389778794813,29.938977879481314
> C77.99389778794813,38.99627926877361 64.97395582555245,46.33867276887872
> 48.913043478260875,46.33867276887872 C32.852131130969305,46.33867276887872
> 19.83218916857361,38.99627926877361 19.83218916857361,29.938977879481314
> C19.83218916857361,20.881676490189015 32.852131130969305,13.539282990083906
> 48.913043478260875,13.539282990083906Z"
>  stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/>
> <path stroke-linecap="square" fill-opacity="1.0" fill="none"
> fill-rule="nonzero" stroke-linejoin="miter" style="stroke:#000"
> d="M1.0526315789473684,1.4736842105263157
> C1.0526315789473684,1.4736842105263157 98.73684210526316,1.4736842105263157
> 98.73684210526316,1.4736842105263157 C98.73684210526316,1.4736842105263157
> 98.73684210526316,98.52631578947368 98.73684210526316,98.52631578947368
> C98.73684210526316,98.52631578947368 1.0526315789473684,98.52631578947368
> 1.0526315789473684,98.52631578947368 C1.0526315789473684,98.52631578947368
> 1.0526315789473684,1.4736842105263157
> 1.0526315789473684,1.4736842105263157Z"
> stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/><path
> stroke-linecap="square" fill-opacity="1.0" fill="none" fill-rule="nonzero"
> stroke-linejoin="miter" style="stroke:#000"
> d="M5.684210526315789,5.473684210526316
> C5.684210526315789,5.473684210526316
> 86.52631578947368,90.52631578947368 86.52631578947368,90.52631578947368"
> stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/><path
> stroke-linecap="square" fill-opacity="1.0" fill="none" fill-rule="nonzero"
> stroke-linejoin="miter" style="stroke:#000"
> d="M6.105263157894737,89.6842105263158 C6.105263157894737,89.6842105263158
> 93.89473684210526,6.736842105263165 93.89473684210526,6.736842105263165"
> stroke-width="0.1" stroke-opacity="1.0" stroke-miterlimit="1.0"/></svg>
>
> --
> Configure bugmail:
> https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are the assignee for the bug.
>

DO NOT REPLY [Bug 48575] When generating EPS from SVG image content doesn't fit borders

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48575

--- Comment #5 from Glenn Adams <gl...@skynav.com> 2012-04-07 01:44:39 UTC ---
resetting P2 open bugs to P3 pending further review

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48575] When generating EPS from SVG image content doesn't fit borders

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48575

--- Comment #3 from Peter Hancock <pe...@gmail.com> 2010-01-20 03:23:50 UTC ---
Hi Paul,

I am a little unclear what the problem is here.  I rendered your svg and
produced the attached eps an pdf to compare.  They both look the same to me. 
Can you elaborate on the problem with reference to my attached images, please?

Peter

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48575] When generating EPS from SVG image content doesn't fit borders

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48575

Glenn Adams <gl...@skynav.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48575] When generating EPS from SVG image content doesn't fit borders

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48575

--- Comment #1 from Peter Hancock <pe...@gmail.com> 2010-01-20 03:23:07 UTC ---
Created an attachment (id=24863)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24863)
renedered eps

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.