Manual page for Scalable_vector_graphics_(SVG)_format(PL)

Google




Scalable vector graphics (SVG) format


Welcome     Gallery     Handbook


ploticus (2.01 or higher, all builds) can produce graphics in SVG format. SVG is a vector graphic format supported by Adobe Systems and defined in a W3C spec . SVGs look good because nice fonts are standard, and graphics are easily scaled up or down with no degradation in appearance. SVG can be viewed with newer versions of Netscape and MSIE browsers, and can be imported into MS word, MS powerpoint, etc.

SVG files have names ending in .svg. SVG files can also be compressed for smaller size; these files have names ending in .svgz. Browsers and applications that understand SVG generally understand SVG also. Compression requires zlib and hence may not be available in all ploticus builds.


Generating SVG

To generate SVG, use the -svg or -svgz command line option (-svgz gives you compressed svg results).
pl -svgz -tag bars2.pl

Output files will have an .svg or .svgz ending by default. The -tag option may be used to have a suitable HTML <EMBED> tag written to standard output. The -zlevel n option may be used to set the compression level to n (0 - 9 where 9 is highest level of compression).


Embedding SVG graphics within HTML

Netscape and MSIE display SVGs using a the Adobe SVG viewer plug-in. To include an SVG graphic in an HTML document, use an <EMBED> tag like this:

<embed src="bars2.svg" name="SVGEmbed" width="500" height="616"

The width and height attributes control the size of the graphic so you can adjust these to resize the graphic if desired (the height/width ratio should remain constant). As with the <img> tag, src can be any URL, including CGI invocation. As mentioned above, the -tag command line option may be used to generate a suitable html <embed> tag containing appropriate height and width values, for convenience.


Examples

Here is a page of some SVG examples (plug-in will be required). Notice how the full size graphics are automatically sized to your browser window.


Fonts

Default font is Helvetica. Postscript font names such as Times-Roman and Courier may be used. More info


Clickable maps

Versions 2.04+ support clickable maps for SVG. Here's an example.


Importing SVG into applications

Microsoft Office applications can import SVG graphics. On the version I have, import via dragging and dropping works. Import via the "Insert graphic" menu does not.


Troubleshooting

The location for downloading the SVG viewer is www.adobe.com/svg/viewer/install . Follow the instructions there for easy installation. Then restart your browser. If your Netscape browser doesn't display SVG properly when originating via a web server, try accessing an SVG file directly using file:///. If this works then there is probably a mime types problem with your web server. Ask your web server administrator to add a mime.types entry such as this:

Or with apache you can add lines like this to your .htaccess file:


I have noticed that the SVG viewer plugin works differently for Netscape vs. IE, and that there is some occasional flakiness, at least on my system. Netscape seems more likely to default to postage-stamp size graphics when sizes aren't fully specified.


Acknowledgement

Many thanks to Bill Traill ( bill@traill.demon.co.uk ) for initiating ploticus SVG support and writing the ploticus SVG driver.





data display engine  
Copyright Steve Grubb


Markup created by unroff 1.0,    December 10, 2002.