XML::Handler::AxPoint - AxPoint XML to PDF Slideshow generator
use XML::SAX::Machines qw(Pipeline); use XML::Handler::AxPoint; Pipeline( XML::Handler::AxPoint->new() )->parse_uri("presentation.axp");
Or using directly:
use XML::SAX; use XML::Handler::AxPoint; my $parser = XML::SAX::ParserFactory->parser( Handler => XML::Handler::AxPoint->new( Output => "presentation.pdf" ) ); $parser->parse_uri("presentation.axp");
This module is a port and enhancement of the AxKit presentation tool, AxPoint. It takes an XML description of a slideshow, and generates a PDF. The resulting presentations are very nice to look at, possibly rivalling PowerPoint, and almost certainly better than most other freeware presentation tools on Unix/Linux.
The presentations support slide transitions, PDF bookmarks, bullet points, source code (fixed font) sections, images, SVG vector graphics, tables, colours, bold and italics, hyperlinks, and transition effects for all the bullet points, source, and image sections.
This is the outer element, and must always be present.
<slideshow> <title>My First Presentation</title>
The title of the slideshow, used on the first (title) slide.
<metadata> <speaker>Matt Sergeant</speaker> <email>firstname.lastname@example.org</email> <organisation>AxKit.com Ltd</organisation> <link>http://axkit.com/</link> <logo scale="0.4">ax_logo.png</logo> <background scale="1.1page">redbg.png</background> <bullet level="1">n</bullet> <bullet level="2">l</bullet> <bullet level="3">u</bullet> <bullet level="4">F</bullet> <numbers level="3">item#$1 -</numbers> <numbers level="4">($a)</numbers> </metadata>
Metadata for the slideshow. Speaker and Organisation are used on the first (title) slide, and the email and link are turned into hyperlinks.
The background and logo are used on every slide.
The bullet tags define the bullet characters (taken from the ZapfDingbats font) to be used for various point levels.
Using the numbers tag, you can customize list numbering. The text contained is used as-is, with special sequences replaced by the current point number:
$1 = plain arabic digits,
$A = lower-/uppercase letters,
$I = lower/uppercase roman numbers and $$ = a plain dollar sign.
You are allowed to put <metadata> sections between slides to override settings for all following slides.
<slideset> <title>A subset of the show</title> <subtitle>And a subtitle for it</subtitle>
A slideset groups slides into relevant subsets, with a title and a new level in the bookmarks for the PDF.
The title and subtitle tags can have
href attributes which turn those texts into links.
Slidesets may be nested, in which case you can create a chapter-section-subsection-... structure. Mixing slides and slidesets on the same level will likewise produce the expected results.
<slide transition="dissolve"> <title>Introduction</title> <list> <point>Perl's XML Capabilities</point> </list> <source-code>use XML::SAX;</source-code> </slide>
The slide tag defines a single slide. Each top level tag in the slide can have a
transition attribute, which either defines a transition for the entire slide, or for the individual top level items.
The valid settings for transition are:
The default. Just replace the old page. Use this on top level page items to make them appear one by one.
Two lines sweeping across the screen reveal the page
Multiple lines sweep across the screen to reveal the page
A box reveals the page
A single line sweaping across the screen reveals the page
The old page dissolves to reveal the new page
The dissolve effect moves from one screen edge to another
For example, to have each point on a slide reveal themselves one by one:
<slide> <title>Transitioning Bullet Points</title> <list> <point transition="replace">Point 1</point> <point transition="replace">Point 2</point> <point transition="replace">Final Point</point> </list> </slide>
The point specifies a bullet point to place on your slide.
The point may have a
href attribute, a
transition attribute, and a
level attribute. The
level attribute is still supported and defaults to 1. However, it is recommended to use <list> tags to indicate nesting. The level can go down as far as you please, though you might need to define bullets with <bullet> in <metadata> for levels greater than 4.
The list optionally takes a flag, ordered="ordered", to indicate that the points below should be numbered. <numbers> in <metadata> can be used to customize numbering style.
The <plain> tag denotes plain text to be put on the page without any bullet point. It takes an optional attribute
align with values "left", "center", or "right".
The source-code tag identifies a piece of verbatim text in a fixed font - originally designed for source code.
The image tag works in one of two ways. For backwards compatibility it allows you to specify the URI of the image in the text content of the tag:
Or for compatibility with SVG, you can use xlink:
<image xlink:href="foo.png" xmlns:xlink="http://www.w3.org/1999/xlink"/>
By default, the image is placed centered in the current column (which is the middle of the slide if you are not using tables) and at the current text position. However you can override this using x and y attributes for absolute positioning. You may also specify a scale attribute to scale the image.
Scaling specifiers can look like this:
The supported image formats are those supported by the underlying pdflib library: gif, jpg, png and tiff.
The colour tag specifies a colour for the text to be output. To define the colour, either use the
name attribute, using one of the 16 HTML named colours, or use the
rgb attribute and use a hex triplet like you can in HTML.
Use these tags for italics, bold and underline within text.
Using this tag, you can specify many text attributes in CSS syntax.
<table> <row> <col width="40%"> ... </col> <col width="60%"> ... </col> </row> </table>
AxPoint has some rudimentary table support, as you can see above. This is fairly experimental, and does not do any reflowing like HTML - it only supports fixed column widths and only as percentages. Using a table allows you to layout a slide in two columns, and also have multi-row descriptions of source code with bullet points.
<box x="450" y="250" width="150" height="200"> <plain>Some content, as if this were a full page</plain> </box>
The box tag allows you to position arbitrary content anywhere on the page. Coordinates are specified in PDF-points, i.e., (0,0) is at the bottom left, and (612,450) is at the top right. Note that you may only specify this tag at the top level of a slide, and it is recommended to use it before or after all regular content of that page, but after the title. A slide may contain any number of box tags, however, and they need not be at the same place in the source. Note also that the height tag is effectively ignored - there is no clipping.
<value type="current-slide"/> <value type="today" format="%d.%m.%Y"/>
Inserts a special variable. The type attribute selects which one: slideshow-title, slide-title, logo, background, today, current-slide, total-slides, current-slideset, speaker, organisation, email, link.
Notes: The "logo" and "background" types insert the image as specified by the corresponding tag in <metadata>, using the same size, at the current text position. The 'today' type uses an additional 'format' attribute containing a sprintf() style format string (optional). The total-slides tag is actually cheating - it reads the value from the same named tag in <metadata>. This is useful if you have a preprocessing step to insert the correct value. With all tags, you may encounter problems if you use them outside of <title>, <point> or <plain>.
AxPoint has some SVG support so you can do vector graphics on your slides. Note that the coordinate system is different from the regular coordinate system, (0,0) is at the left top with positive y values going down, which makes it easier to import graphics from external sources.
All SVG items allow the
transition attribute as defined above.
<rect x="100" y="100" width="300" height="200" style="stroke: blue; stroke-width=5; fill: red"/>
As you can see, AxPoint's SVG support uses CSS to define the style. The above draws a rectangle with a thick blue line around it, and filled in red.
<circle cx="50" cy="100" r="50" style="stroke: black"/>
<ellipse cx="100" cy="50" rx="30" ry="60" style="fill: aqua;"/>
<line x1="50" y1="50" x2="200" y2="200" style="stroke: black;"/>
<text x="200" y="200" style="stroke: black; fill: none; font: italic 24pt serif" >Some Floating Text</text>
This tag allows you to float text anywhere on the screen.
Please use http://rt.cpan.org/ for reporting bugs.
Matt Sergeant, email@example.com
This is free software, distributed under the same terms as Perl itself.