xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pentony, Paul" <Paul.Pent...@defence.gov.au>
Subject sec unclas: Printing SVG to scale using FOP or otherwise.
Date Fri, 14 May 2004 04:15:13 GMT

I am using SVG to develop a web based interactive mapping system.  Users are
able to compose maps in a web browser using the Adobe SVG viewer.  I want to
be able to print them as precisely as possible to scale.  The way I am
trying to do it is to return the SVG to the server then use FOP to convert
it to a PDF.

Obviously it is essential that I can precisely control the size of the SVG
viewport in the printed output. 

The approach we have tried is to use FOP to convert the SVG to a PDF.  To do
this we embeded the SVG as an inline foreign object in an FO file.   We have
tried setting setting the width and height of the SVG element in cm and
setting the content-width and content-height of the insstream-foreign object
to the corresponding values, also in cm.   The actual file is shown at the
end of this message.

According to my calculations the width of the black rectangle that is
printed in this way should be 10 cm.  However in fact it is approximaely
3.5cm.  Is there something that I am doing wrong - or is there another way
to achieve my objective of printing an SVG document to a precise scale?

<?xml version="1.0" encoding="utf-8"?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"

    <fo:simple-page-master master-name="simple"
      <fo:region-body margin-top="3cm" margin-bottom="1.5cm"/>
      <fo:region-before extent="3cm"/>
      <fo:region-after extent="1.5cm"/>

  <fo:page-sequence master-reference="simple">

    <fo:flow flow-name="xsl-region-body">

        <fo:block space-before.optimum="3pt" space-after.optimum="20pt">
	        <fo:instream-foreign-object content-width='25cm'
				<svg:svg width='25cm' height='12.5cm'
viewbox='0 0 250 125' preserveAspectRatio="xMinYMin meet">
						<svg:g id='testGroup'
						<svg:rect id='testRect'
x='50' y='50' width='100' height='50' style='stroke:black'/>


Paul Pentony
TASMIS Project Office
Directorate of Training Area Management
Corporate Services and Infrastructure Group

(02) 6266 3806 (ph)   (02) 6266 9999 (fax)

Paul Pentony

To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

View raw message