## Document related Commands

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.

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() -> bool`

  Returns true if there is a document open.

loadStylesFromFile(...)
  `loadStylesFromFile("filename")`

  Loads paragraph styles from the Scribus document at "filename" into the current document.

newDoc(...)
  `newDoc(size, margins, orientation, firstPageNumber, unit, facingPages, firstSideLeft) -> 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_<paper_type> e.g. PAPER_A4 etc.
  - margins = A tuple (left, right, top, bottom) describing the document margins
  - orientation = the page orientation - constants PORTRAIT, LANDSCAPE
  - firstPageNumber = is the number of the first page in the document used for page numbering. 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.
  - facingPages = FACINGPAGES, NOFACINGPAGES
  - firstSideLeft = FIRSTPAGELEFT, FIRSTPAGERIGHT

  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.

  example: newDoc(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 1, UNIT_POINTS, FACINGPAGES, FIRSTPAGERIGHT)

openDoc(...)
  `openDoc("name")`

  Opens the document "name".

  May raise ScribusError if the document could not be opened.

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.

setInfo(...)
  `saveDocAs("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_<type> constants.

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.

setUnit(...)
  `setUnit(type)`

  Changes the measurement unit of the document. Possible values for "unit" are defined as constants UNIT_<type>.

  May raise ValueError if an invalid unit is passed.