You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jeremias Maerki <je...@outline.ch> on 2002/04/16 17:10:02 UTC
Transformation matrix wrong in PDF for some SVG files
Hi Foppers
For once, I'm here with a problem. It's driving me crazy (probably
because I'm not so good at math).
I've got a few SVG files that work without problems and I've got a few
that FOP 0.20.3cvs (14.2.2002) and FOP 0.20.4cvs (today) won't handle.
I've identified the problem spot but haven't been able to find a fix,
yet. Acrobat 5 will show the error message "Wrong operand type" because
the second transformation matrix written by PDFRenderer.renderSVGDocument()
is "0 0 0 0 0 0 cm" instead of "x 0 0 x 0 0 cm" (where x > 0).
Here's the except from the PDF:
<snip/>
q
q
28.346 811.343 m
212.346 811.343 l
212.346 559.343 l
28.346 559.343 l
h
W
n
1.0 0 0 -1.0 28.346 811.343 cm
0 0 0 0 0 0 cm
q
0 0 m
6500 0 l
6500 8900 l
0 8900 l
0 0 l
h
W
n
0 g
0 G
2607 4214 m
2367 4225 l
2136 4259 l
1909 4314 l
1687 4390 l
1467 4485 l
<snip what="more PDF"/>
I have attached a small FO file and an external SVG file describing a
male sign. male.svg alone renders fine in Adobe SVG Plugin, CorelDraw
and Batik v1.1 Browser. If I exchange the male.svg by boxes.svg from
docs/examples/svg, everything works as expected.
Thanks in advance for any help!
Cheers,
Jeremias Märki
mailto:jeremias.maerki@outline.ch
OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Tel. +41 41 317 2020 - Fax +41 41 317 2029
Internet http://www.outline.ch
Re: Transformation matrix wrong in PDF for some SVG files
Posted by Jeremias Maerki <je...@outline.ch>.
> I can't see what the problem is but I can give you some hints.
>
> I would suggest testing the svg rendering using the transcoder through
> batik, so it converts the svg directly to pdf. This works with the cvs
> trunk also but be aware that there are some differences.
I'll try that.
> I suspect the problem is due to the numbers being used in the svg file.
> The viewport and path numbers are large and the size is relatively small.
> I think it is trying to scale the svg and the numbers are getting
> truncated/rounded to zero.
I guess you're right. I've had a closer look at the AffineTransform
object that it returned by the ViewBox class. It had very small values
(0.028307 and the like) which were rounded to zero by PDFNumber (strange
rounding code in there anyway). I'll investigate some more.
Thanks a lot for the tips!
Cheers,
Jeremias Märki
mailto:jeremias.maerki@outline.ch
OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Tel. +41 41 317 2020 - Fax +41 41 317 2029
Internet http://www.outline.ch
Re: Transformation matrix wrong in PDF for some SVG files
Posted by Keiron Liddle <ke...@aftexsw.com>.
Hi Jeremias,
I can't see what the problem is but I can give you some hints.
I would suggest testing the svg rendering using the transcoder through
batik, so it converts the svg directly to pdf. This works with the cvs
trunk also but be aware that there are some differences.
I suspect the problem is due to the numbers being used in the svg file.
The viewport and path numbers are large and the size is relatively small.
I think it is trying to scale the svg and the numbers are getting
truncated/rounded to zero.
On 2002.04.16 17:10 Jeremias Maerki wrote:
> Hi Foppers
>
> For once, I'm here with a problem. It's driving me crazy (probably
> because I'm not so good at math).
>
> I've got a few SVG files that work without problems and I've got a few
> that FOP 0.20.3cvs (14.2.2002) and FOP 0.20.4cvs (today) won't handle.
> I've identified the problem spot but haven't been able to find a fix,
> yet. Acrobat 5 will show the error message "Wrong operand type" because
> the second transformation matrix written by
> PDFRenderer.renderSVGDocument()
> is "0 0 0 0 0 0 cm" instead of "x 0 0 x 0 0 cm" (where x > 0).
>
> Here's the except from the PDF:
> <snip/>
> q
> q
> 28.346 811.343 m
> 212.346 811.343 l
> 212.346 559.343 l
> 28.346 559.343 l
> h
> W
> n
> 1.0 0 0 -1.0 28.346 811.343 cm
> 0 0 0 0 0 0 cm
> q
> 0 0 m
> 6500 0 l
> 6500 8900 l
> 0 8900 l
> 0 0 l
> h
> W
> n
> 0 g
> 0 G
> 2607 4214 m
> 2367 4225 l
> 2136 4259 l
> 1909 4314 l
> 1687 4390 l
> 1467 4485 l
> <snip what="more PDF"/>
>
> I have attached a small FO file and an external SVG file describing a
> male sign. male.svg alone renders fine in Adobe SVG Plugin, CorelDraw
> and Batik v1.1 Browser. If I exchange the male.svg by boxes.svg from
> docs/examples/svg, everything works as expected.
>
> Thanks in advance for any help!
>
>
> Cheers,
> Jeremias Märki
>
> mailto:jeremias.maerki@outline.ch
>
> OUTLINE AG
> Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
> Tel. +41 41 317 2020 - Fax +41 41 317 2029
> Internet http://www.outline.ch
>