[SOLVED] new document with size A3 landscape?

Previous topic - Next topic

hjh

Hi

I want to create a new document in size A3 landscape with the code inserted below.
I get a document which is more than 1 meter wide. What am I missing here?

--Hannes

# encoding: utf-8
#
# (c) CC0, Public domain
#
# Boilerplate for Scribus scripts with creation of a new document
#
# For details see the README file.

try:
    import scribus
except ImportError as ex:
    print('This script must be run from inside Scribus')
    raise ex

def main():
    # Replace the following line by your code
    scribus.newDocument(scribus.PAPER_A3, (10, 10, 10, 10), scribus.LANDSCAPE, 1, scribus.UNIT_MILLIMETERS, scribus.NOFACINGPAGES, scribus.FIRSTPAGERIGHT, 1)

if __name__ == "__main__":
    main()

P.S. I got the newDocument command from
https://wiki.scribus.net/canvas/Elementary_Rectangle

There is also https://impagina.org/scribus-scripter-api/page/
But it does not contain examples.

hjh

Solution

Use
scribus.PAPER_A3_MMinstead of
scribus.PAPER_A3
Where do I get a list of all the possible values?

prcek

I would try running
import scribus
help(scribus)
in python console
--
Any job looks easy until you try doing it yourself.

a.l.e

Indeed, typing help(scribus) in "Script > Show Console" gives you all the commands.

You could also write a Script that you run from inside of Scribus that gets the result of help(scribus) and writes it into a text file.

You can also press F1, open the Scribus help and go to the "For Developers > Scripter API" section and browse it.
Or search for "paper_a5_mm" in there.

Finally, you can go to https://impagina.org/scribus-scripter-api/page/#constants for a description of the API that has a better search function and is a bit better organized (and, sadly, really needs an update! but i'm working on it)

Almost overkill : - )

a.l.e

btw, for examples, you can have a look at the scripts in

https://github.com/aoloe/scribus-script-repository

but i guess you already found that out, when i gave you the link to my version of the boilerplate...

hjh

Thank you prcek and Ale.

This solves the issue.

I have to pay attention that the paper size and the units for the document match
scribus.newDocument(scribus.PAPER_A3_MM, (10, 10, 10, 10), scribus.LANDSCAPE, 1, scribus.UNIT_MILLIMETERS, scribus.NOFACINGPAGES, scribus.FIRSTPAGERIGHT, 1)

--Hannes