DocumentAPI

class DocumentAPI

DocumentAPI provides properties and methods needed to interact with a Scribus document. An instance of DocumentAPI may be obtained from Scripter, for eg.

document = Scripter.activeDocument

DocumentAPI Attributes

DocumentAPI.name

Read the name of current document.:

print document.name

This will be empty for a new document.

DocumentAPI.available

Returns True if the document is available, else False.:

>>> document = Scripter.activeDocument
>>> document.available
True
>>>
DocumentAPI.margins

Return an object of type Margins

DocumentAPI.modified

This attribute is used to check whether the document is modified or not. It can also be used to set a document as modified.:

>>> doc = Scripter.activeDocument
>>> doc.modified
False
>>> doc.modified = True
>>> doc.modified
True
>>>
DocumentAPI.activePage
DocumentAPI.pageCount
DocumentAPI.activeItem
DocumentAPI.dimensions
DocumentAPI.items
DocumentAPI.selection
DocumentAPI.selectionCount
DocumentAPI.colors
DocumentAPI.layers
DocumentAPI.masterPages
DocumentAPI.styles

DocumentAPI Methods

DocumentAPI.close()

Closes a document. Returns True is successful, else return False.

>>> document = Scripter.activeDocument
>>> document.close()
True
>>>
DocumentAPI.save()

Saves the current document, and return True is successful. If the document is a new one (i.e., you are trying to save it for the first time), calling this function will result in invocation of Save As dialog, where you can enter the name for your document.

>>> document = Scripter.activeDocument
>>> document.save()
True
>>>
DocumentAPI.saveAs(name)
DocumentAPI.setInformation(author, title, description)
DocumentAPI.newLayer(name)
DocumentAPI.removeLayer(name)
DocumentAPI.getActiveLayer()

Make it property

DocumentAPI.setActiveLayer(name)

Make it property

DocumentAPI.getActiveLayerName()

Make it property

DocumentAPI.newColorCMYK(c, m, y, k)
DocumentAPI.newColorRGB(r, g, b)
DocumentAPI.getColor(name)

Make it property

DocumentAPI.supportedImageTypes()
DocumentAPI.exportAsImages(directoryName, scale, quality, dpi, overwrite)
blog comments powered by Disqus