File: scripterapi-doc.html

package info (click to toggle)
scribus-doc 1.5.6.1%2Bdfsg-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bullseye
  • size: 59,640 kB
  • sloc: xml: 767; python: 157; makefile: 14
file content (196 lines) | stat: -rw-r--r-- 12,408 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>Document related Commands</title>
</head>
<style>
@import "manual.css";
</style>
<body>
<h2>Document related Commands</h2>

<dl>

<dt><a name="-closeDoc"><strong>closeDoc</strong></a>(...)</dt>
<dd><code>closeDoc()</code>
<p>Closes the current document without prompting to save.</p>
<p>May throw <a href="#NoDocOpenError">NoDocOpenError</a> if there is no document to close</p></dd>

<dt><a name="-docChanged"><strong>docChanged</strong></a>(...)</dt>
<dd><code>docChanged(bool)</code>
<p>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.</p></dd>

<dt><a name="-getDocName"><strong>getDocName</strong>(...)</dt>
<dd><code>getDocName() -&gt; string</code>
<p>Returns the name of current file</p>
</dd>
</dt>

<dt><a name="-getUnit"><strong>getUnit</strong></a>(...)</dt>
<dd><code>getUnit() -&gt; integer (Scribus unit constant)</code>
<p>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.</p>
<p>Typically you may use this command so that you can change the measurement units to something else, for which you are creating or modifying objects based some particular units, like points, after which you want to return to whatever the original units were.</p><p><b>original = getUnit()</b></p>
<p><i>do some operations...then later</i></p>
<p><b>setUnit(original)</b></p>
</dd>

<dt><a name="-haveDoc"><strong>haveDoc</strong></a>(...)</dt>
<dd><code>haveDoc() -&gt; bool</code>
<p>Returns true if there is a document open. Since this returns a boolean, typically this will be used in a conditional clause:</p>
<p><b>if haveDoc():</b></p>
<p>so that you can deal with the situation where no document exists with an <b>else:</b> clause.</p></dd>

<!--<dt><a name="-importSVG"><strong>importSVG</strong>(...)</a></dt>
<dd><code>importSVG("string")</code>
<p>The "string" must be a valid filename for a SVG image. The text must be UTF8 encoded or 'unicode' string(recommended).</p></dd> -->

<dt><a name="-loadStylesFromFile"><strong>loadStylesFromFile</strong></a>(...)</dt>
<dd><code>loadStylesFromFile("filename")</code>
<p>Loads paragraph styles from the Scribus document at "filename" into the current document.</p></dd>

<dt><a name="-masterPageNames"><strong>masterPageNames</strong>(...)</a></dt>
<dd><code>masterPageNames()</code>
<p>Returns a list of the names of all master pages in the document.</p></dd>

<dt><a name="-newDoc"><strong>newDoc</strong></a>(...)</dt>
<dd><code>newDoc(size, margins, orientation, firstPageNumber, unit, facingPages, firstSideLeft) -&gt; bool</code>
<p>WARNING: Obsolete procedure! Use <a href="#-newDocument">newDocument</a> instead. Also note that this commands requires 7 parameters, whereas the preferred <b>newDocument()</b> command requires 8.</p>
<p>Creates a new document and returns true if successful. The parameters have the
following meaning:</p>
<ul>
	<li>size = A tuple (width, height) describing the size of the document. You can use predefined constants named PAPER_&lt;paper_type&gt; e.g. PAPER_A4 etc.</li>
	<li>margins = A tuple (left, right, top, bottom) describing the document margins</li>
	<li>orientation = the page orientation - constants PORTRAIT, LANDSCAPE</li>
	<li>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.</li>
	<li>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.</li>
	<li>facingPages = FACINGPAGES, NOFACINGPAGES</li>
	<li>firstSideLeft = FIRSTPAGELEFT, FIRSTPAGERIGHT</li>
	</ul>
<p>The values for width, height and the margins are expressed in the given unit for the document. PAPER_* constants are a series of tuples specific to the document size, with the values corresponding to points. Therefore, if you are creating a document and using UNIT_MILLIMETERS for example, DO NOT USE the PAPER_* constants. A workaround can be to use the PAPER_* constant along with UNIT_POINTS, then follow the command with another command, setUnit(UNIT_MILLIMETERS).</p>
<p>example: <a href="#-newDoc">newDoc</a>(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 1, UNIT_POINTS, FACINGPAGES, FIRSTPAGERIGHT)</p></dd>

<dt><a name="-newDocument"><strong>newDocument</strong>(...)</a></dt>
<dd><code>newDocument(size, margins, orientation, firstPageNumber,
                        unit, pagesType, firstPageOrder, numPages) -&gt; bool</code>
<p>Note that this commands requires 8 parameters, whereas the obsolete <b>newDoc()</b> command required 7. The additional parameter indicates how many pages to create.</p>
<p>Creates a new document and returns true if successful. The parameters have the
following meaning:
<ul>
<li>size = A tuple (width, height) describing the size of the document. You can
use predefined constants named PAPER_&lt;paper_type&gt; e.g. PAPER_A4 etc.</li>
<li>margins = A tuple (left, right, top, bottom) describing the document
margins</li>
<li>orientation = the page orientation - constants PORTRAIT, LANDSCAPE</li>
<li>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.</li>
<li>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.</li>
<li>pagesType = One of the predefined constants PAGE_n. PAGE_1 is single page,
PAGE_2 is for double sided documents, PAGE_3 is for 3 pages fold and
PAGE_4 is 4-fold.</li>
<li>firstPageOrder = What is position of first page in the document.
Indexed from 0 (0 = first).</li>
<li>numPage = Number of pages to be created.</li>
</ul>
<p>The values for width, height and the margins are expressed in the given unit
for the document. PAPER_* constants are a series of tuples specific to the document size, with the values corresponding to points. Therefore, if you are creating a document and using UNIT_MILLIMETERS for example, DO NOT USE the PAPER_* constants.</p>
<p>For A and B paper formats there are now new constants to use with UNIT_MILLIMETERS, named for example, PAPER_A4_MM, or PAPER_B6_MM.</p>
<p>Examples:</p>
<p><b>newDocument(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 7, UNIT_POINTS, PAGE_4, 3, 1)</b></p>
<p><b>newDocument(PAPER_A4_MM, (10, 10, 20, 20), LANDSCAPE, 7, UNIT_MILLIMETERS, PAGE_4, 3, 1)</b></p>
<p>May raise ScribusError if is firstPageOrder bigger than allowed by pagesType.</p>
</dd>

<dt><a name="-openDoc"><strong>openDoc</strong></a>(...)</dt>
<dd><code>openDoc("name")</code>
<p>Opens the document "name".</p>
<p>May raise ScribusError if the document could not be opened.</p></dd>

<dt><a name="-placeEPS"><strong>placeEPS</strong>(...)</a></dt>
<dd><code>placeEPS("filename", x, y)</code>
<p>Places the EPS "filename" onto the current page, x and y specify the coordinate 
of the topleft corner of the EPS placed on the page.</p>
<p>If loading was successful, the selection contains the imported EPS.</p></dd>

<dt><a name="-placeODG"><strong>placeODG</strong>(...)</a></dt>
<dd><code>placeODG("filename", x, y)</code>
<p>Places the ODG "filename" onto the current page, x and y specify the coordinate 
of the topleft corner of the ODG placed on the page.</p>
<p>If loading was successful, the selection contains the imported ODG.</p></dd>

<dt><a name="-placeSVG"><strong>placeSVG</strong>(...)</a></dt>
<dd><code>placeSVG("filename", x, y)</code>
<p>Places the SVG "filename" onto the current page, x and y specify the coordinate 
of the topleft corner of the SVG placed on the page.</p>
<p>If loading was successful, the selection contains the imported SVG.</p></dd>

<dt><a name="-placeSXD"><strong>placeSXD</strong>(...)</a></dt>
<dd><code>placeSXD("filename", x, y)</code>
<p>Places the SXD "filename" onto the current page, x and y specify the coordinate 
of the topleft corner of the SXD placed on the page.</p>
<p>If loading was successful, the selection contains the imported SXD.</p></dd>

<dt><a name="-placeVectorFile"><strong>placeVectorFile</strong>(...)</a></dt>
<dd><code>placeVectorFile("filename", x, y)</code>
<p>Places the vector graphics "filename" onto the current page, x and y specify the coordinate 
of the topleft corner of the graphic placed on the page.</p>
<p>If loading was successful, the selection contains the imported graphic.</p></dd>

<dt><a name="-revertDoc"><strong>revertDoc</strong></a>(...)</dt>
<dd><code>revertDoc()</code>
<p>Revert the current document to its last saved state.</p></dd>

<dt><a name="-saveDoc"><strong>saveDoc</strong></a>(...)</dt>
<dd><code>saveDoc()</code>
<p>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.</p></dd>

<dt><a name="-saveDocAs"><strong>saveDocAs</strong></a>(...)</dt>
<dd><code>saveDocAs("name")</code>
<p>Saves the current document under the new name "name" (which may be a full or
relative path).</p>
<p>May raise ScribusError if the save fails.</p></dd>

<dt><a name="-setBaseLine"><strong>setBaseLine</strong></a>(...)</dt>
<dd><code>setBaseLine(grid, offset)</code>
<p>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_&lt;type&gt; constants.</p></dd>

<dt><a name="-setBleeds"><strong>setBleeds</strong></a>(...)</dt>
<dd><code>setBleeds(lr, rr, tr, br)</code>
<p>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_&lt;type&gt; constants.</p></dd>

<dt><a name="-setDocType"><strong>setDocType</strong></a>(...)</dt>
<dd><code>setDocType(facingPages, firstPageLeft)</code>
<p>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.</p></dd>

<dt><a name="-setInfo"><strong>setInfo</strong></a>(...)</dt>
<dd><code>setInfo("author", "info", "description") -&gt; bool</code>
<p>Sets the document information. "Author", "Info", "Description" are strings.</p></dd>

<dt><a name="-setMargins"><strong>setMargins</strong></a>(...)</dt>
<dd><code>setMargins(lr, rr, tr, br)</code>
<p>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_&lt;type&gt; constants.</p></dd>

<dt><a name="-setUnit"><strong>setUnit</strong></a>(...)</dt>
<dd><code>setUnit(type)</code>
<p>Changes the measurement unit of the document. Possible values for "unit" are defined as constants UNIT_&lt;type&gt;.</p>
<p>May raise ValueError if an invalid unit is passed.</p>
<p>As noted above, typically you may use this command so that you can change the measurement units to something else, for which you are creating or modifying objects based some particular units, like points, after which you want to return to whatever the original units were.</p><p><b>original = getUnit()</b></p>
<p><i>do some operations...then later</i></p>
<p><b>setUnit(original)</b></p></dd>

<dt><a name="-scrollDocument"><strong>scrollDocument</strong>(...)</a></dt>
<dd><code>scrollDocument(x,y)</code>
<p>Scroll the document in main GUI window by x and y.</p></dd>

<dt><a name="-zoomDocument"><strong>zoomDocument</strong>(...)</a></dt>
<dd><code>zoomDocument(double)</code>
<p>Zoom the document in main GUI window. Actions have whole number
values like 20.0, 100.0, etc. Zoom to Fit uses -100 as a marker.</p></dd>

</dl>
</body>
</html>