Generate a ten page layout with three columns on each page

From Scribus Wiki
Revision as of 10:51, 28 September 2005 by Mikes (talk | contribs)
Jump to navigation Jump to search
This article is part of the Scripts series.

The following script generates a ten page layout with three columns a columnline and a column-headline on each page. It's an example for using some base script elements like newDoc(), newPage(), createText() an so on. Its been tested with scribus 1.3.1cvs on Mac OSX. Please pay attention to the FIRSTPAGELEFT constant. During my tests scribus creates a right page as first page. I think this is a bug and could get corrected next time, so you have to change it to FISTPAGERIGHT.


from scribus import *
newDoc((185, 250), (12, 20, 15, 28), PORTRAIT, 1, UNIT_MILLIMETERS, FACINGPAGES, FIRSTPAGELEFT)

for i in range(9) :
    newPage(-1)

for f in range(1,10,2) :
    gotoPage(f)
    createLine(12, 20, 126, 20)
    createText(71, 15, 55/mm, 6/mm, "Kolumnentitel_"+str(f))
    setText("Kolumnentitel", "Kolumnentitel_"+str(f))
    setTextAlignment(ALIGN_RIGHT, "Kolumnentitel_"+str(f))
    createText(12, 24, 55/mm, 199/mm, "Kolumne_"+str(f)+"_rechts_1")
    createText(71, 24, 55/mm, 199/mm, "Kolumne_"+str(f)+"_rechts_2")
    createText(130, 24, 35/mm, 199/mm, "Kolumne_"+str(f)+"_rechts_3")
    gotoPage(f+1)
    createLine(59, 20, 173, 20)
    createText(59, 15, 55/mm, 6/mm, "Kolumnentitel_"+str(f+1))
    setText("Kolumnentitel", "Kolumnentitel_"+str(f+1))
    setTextAlignment(ALIGN_LEFT, "Kolumnentitel_"+str(f+1))
    createText(20, 24, 35/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_1")
    createText(59, 24, 55/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_2")
    createText(118, 24, 55/mm, 199/mm, "Kolumne_"+str(f+1)+"_links_3")