[scribus] scribus file format / python

Gregory Pittman gregp_ky at yahoo.com
Mon Jul 4 18:22:45 UTC 2011


On 07/04/2011 01:41 PM, wibr wrote:
> Hi,
>
> so I would like to use Scribus to create some flashcards. It should work
> like this:
> 1. I have a .txt file with my flashcards
> 2. I create two pages in Scribus how they will look like, one for each
> side of the flashcards
> 3. I will do some python magic, load the .txt and create many pages with
> flashcards.
> 4. I can edit the cards if I want or just export them to pdf.
>
> So here is my question: Should I manipulate the xml or let the script
> run in Scribus?
>
> I think editing the xml shouldn't be too hard, but I don't completely
> understand the file format, is there any recent documentation available?
> Especially I would like to know how I could duplicate pages.
> I had a look at it: <PAGE> is a page and it gets a number NUM, and
> <PAGEOBJECT> is something on a page and it has an attribute "OwnPage".
> So I tried to move pageobjects between pages by editing the "OwnPage"
> number, but that didn't work...so how does Scribus know, which object
> belongs to which page?
>
> Or maybe using python in Scribus would be easier? I am more familiar
> with xml editing, though...
>

Hi Wilhelm,

I would start by manually making a few cards, so that you can work out 
document page size, what sort of font, font size and style, spacing, 
etc., you want to use.

After that, I would be inclined to use a script inside Scribus to make a 
document from a text file, so that you can create pages as needed, with 
frames, paragraph styles and so on.
You might make it less demanding on the scripting end by just putting 
text into new frames on as many pages as needed, then applying the 
styles in Scribus later.
Here is a simple script showing some of the methods:
http://wiki.scribus.net/canvas/Importing_addresses_from_a_text_file

Having said that, it's worth making a 2-page document, then looking at 
the SLA file to see how much work it would be to generate a file using 
python outside of Scribus. I sense that you have a long way to go to 
understand what parts of the file are used for various aspects of the 
document. Even if you know xml, I think you'll find an SLA file challenging.

Another approach /might/ come from using text filters, but then I think 
you would need to deal with the problem of making new pages and frames...

Greg



More information about the scribus mailing list