[xep-support] PDF "corrupt" after inserting SVG image

Arjan Loeffen arjan at salience.nl
Wed Jul 9 05:36:41 PDT 2003


Nikolai,

thanks for your elaborate answer. I'll send the PDF to the Adobe people and
see what they have to say about this...

arjan

Arjan Loeffen
Mobiel: 06-51364196
Mail: arjan at salience.nl <mailto:arjan at salience.nl>

Salience BV
Coltbaan 27b 3439NG Nieuwegein 030-6056675
Web: http://www.salience.nl



-----Original Message-----
From: owner-xep-support at renderx.com
[mailto:owner-xep-support at renderx.com]On Behalf Of Nikolai Grigoriev
Sent: Wednesday, July 09, 2003 10:44 AM
To: xep-support at renderx.com
Subject: Re: [xep-support] PDF "corrupt" after inserting SVG image


Arjan,

> If I specify the following SVG:
>
>  <svg width="4cm" height="4cm" viewBox="0 0 400 400"
xmlns="http://www.w3.org/2000/svg">
>    <rect x="1" y="1" width="40cm" height="40cm"
style="fill:none;stroke:rgb(0,0,255)"/>
>  </svg>
>
> This results in an error in Acrobat 6 (not in Xep): it cannot be rendered.

I could not reproduce the problem in Acrobat 5.

> Note that
>      <rect x="1" y="1" width="4cm" height="4cm"
style="fill:none;stroke:rgb(0,0,255)"/>
> works fine.

There is no difference in the way the two rectangles are encoded, except for
the fact
that the first does not fit into the clipping rectangle and gets trimmed. I
wonder
why this is causing problems for Acrobat 6.

> How should the SVG width, heigth, viewbox and rectangle dimensions relate
> in order to prevent such problems?

The interplay between these parameters is specified in the SVG
Recommendation.
In XEP, 1 inch is mapped to 120 px (= unscaled user units), both for SVG and
for other graphical formats. Note that, according to the SVG spec, absolute
lengths inside an element with a viewBox are pretty meaningful: they are
converted to user units by applying a constant scaling ratio, and since the
user unit itself is modified by scaling, the resulting length will be
different
from the expected. In your case, the figures are as follows:

- viewBox="0 0 400 400" is mapped to a viewport of 4cm x 4cm using the
default
preserveAspectRatio="xMidYMid meet". This gives a user unit of 0.1mm
in both directions.

- inside, the rectangle side of 40cm is first converted to user units
(pixels): 40cm = 1890px.
This corresponds to 18.9 cm of real length - well beyond the SVG viewport
size.

As a rule of thumb, I suggest avoiding use of absolute lengths if you set a
viewBox. They
produce nothing but confusion, and introduce an extra formatter-dependent
factor (the
conversion ratio).

> It looks like a Xep bug anyway.

Well, Acrobat 6 appeared quite recently: it may also contain bugs :-) - or
it may be
that it takes a stricter stance on the PDF spec, and discovers problems we
didn't know
before. Thank you for the report anyway; it is very useful for us to know
about these
things. We will continue investigation.

Best regards,
Nikolai Grigoriev
RenderX

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service
http://www.renderx.com/tos.html

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



More information about the Xep-support mailing list