Document
closeDoc
closeDoc()
Closes the current document without prompting to save.
May throw NoDocOpenError if there is no document to close
docChanged
docChanged(bool)
Enable/disable save icon in the Scribus icon bar and the Save menu item. It's useful to call this procedure when you're changing the document, because Scribus won't automatically notice when you change the document using a script.
getDocName
getDocName() -> string
Returns the name the document was saved under. If the document was not saved before the name is empty.
getInfo
getInfo() -> "author", "info", "description"
Gets the document information. "Author", "Info", "Description" are strings.
getUnit
getUnit() -> integer (Scribus unit constant)
Returns the measurement units of the document. The returned value will be one of the UNIT_* constants: UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS.
haveDoc
haveDoc() -> int
Returns the quantity of open documents: 0 if none are opened.
newDocument
newDocument(size, margins, orientation, firstPageNumber, unit, pagesType, firstPageOrder, numPages) -> bool
Creates a new document and returns true if successful. The parameters have the following meaning:
size = A tuple (width, height) describing the size of the document. You can use predefined constants named PAPER_
margins = A tuple (left, right, top, bottom) describing the document margins
orientation = the page orientation - constants PORTRAIT, LANDSCAPE
firstPageNumer = is the number of the first page in the document used for pagenumbering. While you'll usually want 1, it's useful to have higher numbers if you're creating a document in several parts.
unit: this value sets the measurement units used by the document. Use a predefined constant for this, one of: UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS.
pagesType = One of the predefined constants PAGE_n. PAGE_1 is single page, PAGE_2 is for facing pages documents, PAGE_3 is for 3 pages fold and PAGE_4 is 4-fold.
firstPageOrder = What is position of first page in the document. Indexed from 0 (0 = first).
numPage = Number of pages to be created.
The values for width, height and the margins are expressed in the given unit for the document. PAPER_ constants are expressed in points. If your document is not in points, make sure to account for this. Use UNIT_MM if you use PAPER_A_MM or PAPER_B*_MM constants. PAPER_A0_MM through PAPER_A9_MM and PAPER_B0_MM through PAPER_B10_MM are available.
example: newDocument(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 7, UNIT_POINTS, PAGE_4, 3, 1)
May raise ScribusError if is firstPageOrder bigger than allowed by pagesType.
openDoc
openDoc("name")
Opens the document "name".
May raise ScribusError if the document could not be opened.
redrawAll
redrawAll()
Redraws all pages.
revertDoc
revertDoc()
Revert the current document to its last saved state.
saveDoc
saveDoc()
Saves the current document with its current name, returns true if successful. If the document has not already been saved, this may bring up an interactive save file dialog.
If the save fails, there is currently no way to tell.
saveDocAs
saveDocAs("name")
Saves the current document under the new name "name" (which may be a full or relative path).
May raise ScribusError if the save fails.
setBaseLine
setBaseLine(grid, offset)
Sets the base line settings of the document, grid spacing(grid), grid offset(offset). Values are given in the measurement units of the document - see UNIT_
setBleeds
setBleeds(lr, rr, tr, br)
Sets the bleeds of the document. Left(lr), Right(rr), Top(tr) and Bottom(br) bleeds are given in the measurement units of the document - see UNIT_
setDocType
setDocType(facingPages, firstPageLeft)
Sets the document type. To get facing pages set the first parameter to FACINGPAGES, to switch facingPages off use NOFACINGPAGES instead. If you want to be the first page a left side set the second parameter to FIRSTPAGELEFT, for a right page use FIRSTPAGERIGHT.
setInfo
setInfo("author", "info", "description") -> bool
Sets the document information. "Author", "Info", "Description" are strings.
setMargins
setMargins(lr, rr, tr, br)
Sets the margins of the document, Left(lr), Right(rr), Top(tr) and Bottom(br) margins are given in the measurement units of the document - see UNIT_
setRedraw
setRedraw(bool)
Disables page redraw when bool = False, otherwise redrawing is enabled. This change will persist even after the script exits, so make sure to call setRedraw(True) in a finally: clause at the top level of your script.
setUnit
setUnit(type)
Changes the measurement unit of the document. Possible values for "unit" are defined as constants UNIT_
May raise ValueError if an invalid unit is passed.
Constants
Measurement units
c
cm
inch
mm
p
pt
Measurement units
UNIT_C
UNIT_CENTIMETRES
UNIT_CICERO
UNIT_CM
UNIT_IN
UNIT_INCHES
UNIT_MILLIMETERS
UNIT_MM
UNIT_P
UNIT_PICAS
UNIT_POINTS
UNIT_PT
Document layout
NOFACINGPAGES
FACINGPAGES
FIRSTPAGERIGHT
FIRSTPAGELEFT