Pages

currentPage

currentPage() -> integer

Returns the number of the current working page. Page numbers are counted from 1 upwards, no matter what the displayed first page number of your document is.

currentPage

currentPage() -> integer

Returns the number of the current working page. Page numbers are counted from 1 upwards, no matter what the displayed first page number of your document is.

currentPage

currentPage() -> integer Returns the number of the current working page based on the section of the document.

deletePage

deletePage(nr)

Deletes the given page. Does nothing if the document contains only one page. Page numbers are counted from 1 upwards, no matter what the displayed first page number is.

May raise IndexError if the page number is out of range

getAllObjects

getAllObjects([type, page, "layer"]) -> list

Returns a list containing the names of all objects of specified type and located on specified page and/or layer. This function accepts several optional keyword arguments: - type (optional): integer corresponding to item type, by default all items will be returned. - page (optional): index of page on which returned objects are located, by default the current page. The page index starts at 0 and goes to the total number of pages - 1. - layer (optional): name of layer on which returned objects are located, by default the function returns items located on all layers. May throw ValueError if page index or layer name is invalid.

getColumnGuides

getColumnGuides()

Return the column guides for the current page.

The return a dictionary containing: {'number': int, 'gap': int, 'reference': 0|1|2, guides: [real]}

getHGuides

getHGuides() -> list

Returns a list containing positions of the horizontal guides. Values are in the document's current units - see UNIT_ constants.

getPageItems

getPageItems() -> list

Returns a list of tuples with items on the current page. The tuple is: (name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)] means that object named 'Text1' is a text frame (type 4) and is the first at the page...

getPageMargins

getPageMargins()

Returns the document page margins as a (top, left, right, bottom) tuple in the document's current units. See UNIT_ constants and getPageSize().

getPageNMargins

getPageNMargins(nr) -> tuple

Returns a tuple with a particular page's margins measured in the document's current units. See UNIT_ constants and getPageMargins()

getPageNSize

getPageNSize(nr) -> tuple

Returns a tuple with a particular page's size measured in the document's current units. See UNIT_ constants and getPageMargins()

getPageSize

getPageSize() -> tuple

Returns a tuple with document page dimensions measured in the document's current units. See UNIT_ constants and getPageMargins()

getPageSizeList

getPageSizeList() -> list

Returns a list of untranslated valid page size names and their dimensions in the current unit. See UNIT_

getPageType

getPageType() -> integer

Returns the type of the Page, 0 means left Page, 1 is a middle Page and 2 is a right Page

getRowGuides

getRowGuides()

Return the row guides for the current page.

The return a dictionary containing: {'number': int, 'gap': int, 'reference': 0|1|2, guides: [real]}

getVGuides

getVGuides()

See getHGuides.

gotoPage

gotoPage(nr)

Moves to the page "nr" (that is, makes the current page "nr"). Note that gotoPage doesn't (currently) change the page the user's view is displaying, it just sets the page that script commands will operates on.

May raise IndexError if the page number is out of range.

importPage

importPage("fromDoc", (pageList), [create, imortwhere, importwherePage])

Imports a set of pages (given as a tuple) from an existing document (the file name must be given). This function maps the "Page->Import" dropdown menu function. fromDoc: string; the filename of the document to import pages from pageList: tuple; page numbers of pages to import create: number; 0 to replace existing pages, 1 (default) to insert new pages importWhere: number; used if create==1; 0 to create pages before importWherePage, 1 to create pages after importWherePage, 2 (default) to create pages at the end of the document importWherePage: number; used if create==1 and importWhere==0|1; zero-based page number (of the current document) before or after which to import the pages

newPage

newPage(where [,"masterpage"])

Creates a new page. If "where" is -1 the new Page is appended to the document, otherwise the new page is inserted before "where". Page numbers are counted from 1 upwards, no matter what the displayed first page number of your document is. The optional parameter "masterpage" specifies the name of the master page for the new page.

May raise IndexError if the page number is out of range

pageCount

pageCount() -> integer

Returns the number of pages in the document.

setColumnGuides

setColumnGuides(number, gap=0.0, refer_to=0)

Set the column guides for the current page.

number is the number of guides to be defined (if 0, all values get reset to their default)

refer_to can have the values 0 (page), 1 (margin), 2 (selection)

setHGuides

setHGuides(list)

Sets horizontal guides. Input parameter must be a list of guide positions measured in the current document units - see UNIT_ constants.

Example: setHGuides(getHGuides() + [200.0, 210.0] # add new guides without any lost setHGuides([90,250]) # replace current guides entirely

setPageHeight

setPageHeight((height))

Set the document page height in the document's current units. See UNIT_ constants.

setPageNHeightg

setPageNHeightg((height))

Set the document page height in the document's current units. See UNIT_ constants.

setPagenSize

setPagenSize((width, height))

Set the document page dimensions by the page size name. See UNIT_ constants.

setPageNWidth

setPageNWidth((width))

Set the document page width in the document's current units. See UNIT_ constants.

setPageSize

setPageSize((width, height))

Set the document page dimensions by the page size name. See UNIT_ constants.

setPageWidth

setPageWidth((width))

Set the document page width in the document's current units. See UNIT_ constants.

setRowGuides

setRowGuides(number, gap=0.0, refer_to=0)

Set the row guides for the current page.

number is the number of guides to be defined (if 0, all values get reset to their default)

refer_to can have the values 0 (page), 1 (margin), 2 (selection)

setVGuides

setVGuides()

See setHGuides.

Constants

Page sizes

  • PAPER_A0
  • PAPER_A0_MM
  • PAPER_A1
  • PAPER_A1_MM
  • PAPER_A2
  • PAPER_A2_MM
  • PAPER_A3
  • PAPER_A3_MM
  • PAPER_A4
  • PAPER_A4_MM
  • PAPER_A5
  • PAPER_A5_MM
  • PAPER_A6
  • PAPER_A6_MM
  • PAPER_A7
  • PAPER_A7_MM
  • PAPER_A8
  • PAPER_A8_MM
  • PAPER_A9
  • PAPER_A9_MM
  • PAPER_B0
  • PAPER_B0_MM
  • PAPER_B1
  • PAPER_B10
  • PAPER_B10_MM
  • PAPER_B1_MM
  • PAPER_B2
  • PAPER_B2_MM
  • PAPER_B3
  • PAPER_B3_MM
  • PAPER_B4
  • PAPER_B4_MM
  • PAPER_B5
  • PAPER_B5_MM
  • PAPER_B6
  • PAPER_B6_MM
  • PAPER_B7
  • PAPER_B7_MM
  • PAPER_B8
  • PAPER_B8_MM
  • PAPER_B9
  • PAPER_B9_MM
  • PAPER_C5E
  • PAPER_COMM10E
  • PAPER_DLE
  • PAPER_EXECUTIVE
  • PAPER_FOLIO
  • PAPER_LEDGER
  • PAPER_LEGAL
  • PAPER_LETTER
  • PAPER_TABLOID

Page orientation

  • PORTRAIT
  • LANDSCAPE