create new tag
view all tags


Show SVG drawings as PNG pictures embedded in topics


SvgPlugin displays SVG drawings attached in TWiki as PNG images, inline in your topics. It uses the CPAN:Image::LibRSVG Perl module (which uses librsvg), to convert your SVG drawings into PNG pictures.

Syntax Rules

  • %SVG{"drawing" parameters}%
  • where drawing is the filename of an attached SVG image.
  • Parameters:
    Parameter Description Default value
    size the maximum size of the picture. The picture will be generated do fit in this size. SvgPlugin will generate a picture the fits best in the given size, without distorting the image. DEFAULTSIZE setting below
    topic The topic to which the drawing is attached. Can be TheTopic or Web.TheTopic current topic


You type: You should get: You get (if installed):
%SVG{"TWikiBrasil.svg"}% TWikiBrasil-320x200.png %SVG{"TWikiBrasil.svg"}%
%SVG{"TWikiBrasil.svg" size="400x300"}% TWikiBrasil-400x300.png %SVG{"TWikiBrasil.svg" size="400x300"}%
%SVG{}% SvgPlugin: you must specify a drawing to display! %SVG{}%
%SVG{"TWikiBrasil.svg" topic="Main.AntonioTerceiro"}% SvgPlugin: can't find drawing TWikiBrasil.svg attched at Main/AntonioTerceiro. %SVG{"TWikiBrasil.svg" topic="Main.AntonioTerceiro"}%

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %SVGPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Show SVG drawings as PNG pictures embedded in topics

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

  • Default image size:
    • Set DEFAULTSIZE = 320x200

Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Install the Image::LibRSVG Perl module.

  • For an automated installation, run the configure script and follow "Find More Extensions" in the in the Extensions section.

  • Or, follow these manual installation steps:
    • Download the ZIP file from the Plugins home (see below).
    • Unzip SvgPlugin.zip in your twiki installation directory. Content:
      File: Description:
      data/TWiki/SvgPlugin.txt Plugin topic
      lib/TWiki/Plugins/SvgPlugin.pm Plugin Perl module
      pub/TWiki/SvgPlugin/TWikiBrasil.svg Sample SVG drawing
      pub/TWiki/SvgPlugin/TWikiBrasil-320-200.png Sample picture
      pub/TWiki/SvgPlugin/TWikiBrasil-400x300.png Sample picture
    • Set the ownership of the extracted directories and files to the webserver user.
    • Install the dependencies (if any).

  • Plugin configuration and testing:
    • Run the configure script and enable the plugin in the Plugins section.
    • Configure additional plugin settings in the Extensions section if needed.
    • Test if the installation was successful: See example above.

Plugin Info

Plugin Author: TWiki:Main.AntonioTerceiro
Copyright: © 2004 TWiki:Main.AntonioTerceiro
© 2008-2011 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2011-04-06
Change History:  
2011-04-06: TWikibug:Item6638: Doc improvements -- TWiki:Main.PeterThoeny
2004-10-05: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.000
CPAN Dependencies: CPAN:Image::LibRSVG
Other Dependencies: librsvg headers, if needed to compile Image::LibRSVG, and librsvg
Perl Version: tested with 5.8.4
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, SvgPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/SvgPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/SvgPluginDev

Related Topics: TWikiPreferences, UserDocumentationCategory, TWikiPlugins

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng TWikiBrasil-320x200.png r1 manage 9.1 K 2011-04-07 - 05:14 TWikiAdminUser Saved by install script
PNGpng TWikiBrasil-400x300.png r1 manage 14.5 K 2011-04-07 - 05:14 TWikiAdminUser Saved by install script
SVG (Scalable Vector Graphics)svg TWikiBrasil.svg r1 manage 17.0 K 2011-04-07 - 05:14 TWikiAdminUser Saved by install script
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | More topic actions
Topic revision: r3 - 2015-06-17 - TWikiAdminUser
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.SvgPlugin.