This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FOP and SVG?


Hi,

I'm a new DocBook user. I'm in the process of evaluating DocBook XML and
Saxon/FOP for possible use at my company. So far I'm very happy with both
DocBook and Saxon/FOP. However, I can't get FOP to handle SVG images however
hard I try. This really bothers me since I really want us to be able to use SVG
for PDF output. I'm using the following versions of software on a Solaris 8
machine with JDK 1.3.1:

* DocBook XML 4.2
* DocBook XSL Stylesheets 1.57.0
* Saxon 6.5.2
* FOP 0.20.4

I have attached a simple DocBook document (book.xml) who references a simple SVG
image (image.svg). Saxon successfully creates a .fo file, whose SVG image
reference looks ok in my eyes (see code snippet below). FOP then creates a .pdf
file from this .fo file but the SVG image doesn't show up.

I used the following command lines:

> java com.icl.saxon.StyleSheet -x
  org.apache.xml.resolver.tools.ResolvingXMLReader -y
  org.apache.xml.resolver.tools.ResolvingXMLReader -r
  org.apache.xml.resolver.tools.CatalogResolver -u -o book.fo book.xml
  ~steby/xml/docbook-xsl/fo/docbook.xsl

> java org.apache.fop.apps.Fop -fo book.fo -pdf book.pdf

SVG image reference in generated .fo file:
<fo:external-graphic src="url(image.svg)" width="auto" height="auto"
 content-width="auto" content-height="auto"/>

I would be extremely grateful if anybody could shed some light on this matter.
As it is now, I can't get any further with the evaluation; SVG support is a show
stopper.

Regards,
Stefan Bylund

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
               "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd";>

<book id="book">
   <title>Test doc</title>
   <chapter id="c01">
      <title>A Chapter</title>
      <section id="c01s01">
         <title>First Section</title>
         <para>
            Below is a simple SVG image.
         </para>
         <mediaobject>
            <imageobject>
               <imagedata
                  fileref="image.svg"
                  format="SVG"/>
            </imageobject>
            <caption><para>An SVG Image</para></caption>
         </mediaobject>
      </section>
   </chapter>
</book>
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
              "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>

<svg xmlns="http://www.w3.org/2000/svg";>
   <g transform="scale(0.5)">
      <polygon style="fill:red; stroke:blue; stroke-width:10"
               points="350, 75 379,161 469,161 397,215
                       423,301 350,250 277,301 303,215
                       231,161 321,161"/>
   </g>
</svg>
begin:vcard 
n:Bylund;Stefan
tel;cell:+46 709 714 325
tel;work:+46 8 507 143 25
x-mozilla-html:FALSE
url:http://www.ose.com
org:OSE Systems
adr:;;Nytorpsvägen 5;Täby;;183 23;Sweden
version:2.1
email;internet:steby@enea.se
title:Software Engineer
fn:Stefan Bylund
end:vcard

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]