[Scribus] perl program for slide presentation

Gregory Pittman gpittman
Sun Feb 1 22:01:08 CET 2004


My first efforts at this were a sort of ugly brute force way of just
getting perl to generate an .sla file, and while it worked in the sense
of generating something Scribus could view, it was pretty ugly with all
the backslash characters and keeping " separate from \".

So then I found XML::Writer on CPAN, which greatly simplifies the
process of writing tags, and really doesn't care if it's generating a
.xml file or a .sla file. What's nice is you easily nest your perl
program control structures just like the .sla file is nested.

Even for this one-slide "Hello, World!" generating program, it ends up
being about 6 Postscript pages, but the advantage is that each variable
is now on its own line, which if nothing else allows for more easily
playing around with variables to see what they do. It's given me a lot
of insight into how Scribus uses these files.

Example:
One thing I have seen comments about on the List is about not being able
to have different line spacing on different lines of text in a frame.
This is because LINESP is a global variable for PAGEOBJECT, rather than
for the individual ITEXT blocks inside a PAGEOBJECT, even though text
size, font, and color can be individually chosen in each ITEXT block.
So, as currently formatted, .sla files cannot have variable line spacing
within a text frame.

Some notes about scribus.pl:
1. As usual, make sure the #! line finds your perl binary.
2. As is, it *should* run on anyone's distro (I don't have a way of
checking), but you may need to add/change the list of fonts according to
what you have -- perl won't care, but Scribus will. The fonts are listed
twice, once for Scribus, and once for PDF.
3. You do need the XML::Writer module, of course. 'perldoc XML::Writer'
explains the syntax, but this program probably already has all you need
to know. [(startTag() + endTag() versus emptyTag()]
3a. One thing to fix in Writer.pm is line 16 -- change 'use IO;' to 'use
IO::File;' or Perl will complain with the -w switch ('use IO;' is
deprecated).
4. This has my not very creative list of colors -- mostly Scribus defaults.
5. A tag I do not understand is IRENDER -- have no idea how Scribus
generates it, but it doesn't seem to matter for text frames. So in
scribus.pl it's a static value.
6. As currently written, this program simply generates a Scribus file 
(output.sla) according to built-in parameters. You either need to change 
those parameters or write addtional perl code to adapt for other uses.

Gregory Pittman

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: scribus.pl
Url: http://nashi.altmuehlnet.de/pipermail/scribus/attachments/20040201/9ebefaff/attachment.ksh 



More information about the scribus mailing list