jspdf-dynamo 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -16
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +21 -16
- package/documentation/3. Variables/Introduction.txt +15 -12
- package/documentation/3. Variables/SystemMaintained.txt +44 -65
- package/documentation/4. Commands/AddBookmark.txt +3 -3
- package/documentation/4. Commands/AddImageFromFile.txt +3 -3
- package/documentation/4. Commands/AddImageFromUrl.txt +3 -3
- package/documentation/4. Commands/AddPage.txt +1 -1
- package/documentation/4. Commands/CheckPage.txt +2 -2
- package/documentation/4. Commands/Commands.txt +7 -0
- package/documentation/4. Commands/CopyVar.txt +1 -1
- package/documentation/4. Commands/Do.txt +2 -2
- package/documentation/4. Commands/DoRepeat.txt +2 -2
- package/documentation/4. Commands/DrawBox.txt +2 -2
- package/documentation/4. Commands/DrawDebugGrid.txt +2 -2
- package/documentation/4. Commands/DrawImage.txt +2 -2
- package/documentation/4. Commands/DrawLine.txt +2 -2
- package/documentation/4. Commands/DrawTextBox.txt +1 -1
- package/documentation/4. Commands/DrawTextWrapped.txt +40 -17
- package/documentation/4. Commands/ForEachPage.txt +3 -3
- package/documentation/4. Commands/GetEnvVar.txt +2 -2
- package/documentation/4. Commands/IfNotBlank.txt +3 -3
- package/documentation/4. Commands/IncVar.txt +7 -7
- package/documentation/4. Commands/Include.txt +8 -8
- package/documentation/4. Commands/IncludeUrl.txt +43 -1
- package/documentation/4. Commands/MultVar.txt +7 -7
- package/documentation/4. Commands/SavePdf.txt +6 -0
- package/documentation/4. Commands/SelectPage.txt +6 -0
- package/documentation/4. Commands/SetCurrentX.txt +4 -4
- package/documentation/4. Commands/SetCurrentY.txt +2 -2
- package/documentation/4. Commands/SetDocumentInfo.txt +3 -3
- package/documentation/4. Commands/SetFillColour.txt +8 -25
- package/documentation/4. Commands/SetFontName.txt +3 -1
- package/documentation/4. Commands/SetFontSize.txt +2 -0
- package/documentation/4. Commands/SetLineColour.txt +8 -26
- package/documentation/4. Commands/SetLineWidth.txt +1 -1
- package/documentation/4. Commands/SetLogLevel.txt +6 -0
- package/documentation/4. Commands/SetMargin.txt +1 -1
- package/documentation/4. Commands/SetTextColour.txt +43 -0
- package/documentation/4. Commands/SetVar.txt +7 -7
- package/documentation/4. Commands/WriteLog.txt +56 -0
- package/documentation/Documentation.pdf +1993 -1734
- package/documentation/documentation.txt +9 -10
- package/package.json +2 -2
- package/documentation/4. Commands/SetPageOrientation.txt +0 -42
package/dist/index.cjs
CHANGED
|
@@ -118,9 +118,6 @@ var AppLogger = class {
|
|
|
118
118
|
this._logLevel = newLevel;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
if (this._logger.logLevel) {
|
|
122
|
-
this._logger.logLevel(this._logLevel);
|
|
123
|
-
}
|
|
124
121
|
}
|
|
125
122
|
canLog(level) {
|
|
126
123
|
return level >= this._logLevel;
|
|
@@ -357,8 +354,11 @@ var JsPdfProcessor = class {
|
|
|
357
354
|
this._variables.set("_DATEDMY", (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"));
|
|
358
355
|
this._variables.set("_PAGENO", "1");
|
|
359
356
|
this._variables.set("_PAGES", "1");
|
|
357
|
+
this.posnX = 0;
|
|
358
|
+
this.posnY = 0;
|
|
360
359
|
this.spaceHoz = 0;
|
|
361
360
|
this.spaceVert = 0;
|
|
361
|
+
this.currentPageNumber = 1;
|
|
362
362
|
this.lineWidth = this.pointsToUom(mmToPoints(0.2));
|
|
363
363
|
this.lineColour = "black";
|
|
364
364
|
this.fontPointSize = 12;
|
|
@@ -1193,10 +1193,16 @@ var JsPdfProcessor = class {
|
|
|
1193
1193
|
return;
|
|
1194
1194
|
}
|
|
1195
1195
|
let lastObjectHeight = 0;
|
|
1196
|
-
text = text.replace(
|
|
1196
|
+
text = text.replace(/\\[nN]/g, " \n") + " ";
|
|
1197
|
+
const splitText = text.split("\n");
|
|
1198
|
+
const lines = [];
|
|
1199
|
+
for (let line of splitText) {
|
|
1200
|
+
lines.push(...this._pdfDocument.splitTextToSize(line, maxWidth));
|
|
1201
|
+
}
|
|
1202
|
+
if (lines.length > splitText.length) {
|
|
1203
|
+
this._logger.trace(`Text was wrapped into ${lines.length} lines`, lines);
|
|
1204
|
+
}
|
|
1197
1205
|
this.posnY = top;
|
|
1198
|
-
const lines = this._pdfDocument.splitTextToSize(text, maxWidth) || [];
|
|
1199
|
-
this._logger.trace(`Text was wrapped into ${lines.length} lines`, lines);
|
|
1200
1206
|
while (lines.length > 0) {
|
|
1201
1207
|
if (!cmdGroup.startsWith("*")) {
|
|
1202
1208
|
yield jsPdfDynamo.processGroups(this, cmdGroup, false);
|
|
@@ -1838,12 +1844,11 @@ var JsPdfDynamo = class {
|
|
|
1838
1844
|
return null;
|
|
1839
1845
|
}
|
|
1840
1846
|
}
|
|
1841
|
-
toBlobUrl() {
|
|
1847
|
+
toBlobUrl(fileName) {
|
|
1842
1848
|
try {
|
|
1843
|
-
const result = this._processor.PdfDocument.output(
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
);
|
|
1849
|
+
const result = this._processor.PdfDocument.output("bloburi", {
|
|
1850
|
+
filename: fileName
|
|
1851
|
+
});
|
|
1847
1852
|
return result;
|
|
1848
1853
|
} catch (e) {
|
|
1849
1854
|
__privateGet(this, _appLogger).warn(
|
|
@@ -1852,7 +1857,7 @@ var JsPdfDynamo = class {
|
|
|
1852
1857
|
return null;
|
|
1853
1858
|
}
|
|
1854
1859
|
}
|
|
1855
|
-
|
|
1860
|
+
getVariable(variableName) {
|
|
1856
1861
|
var _a;
|
|
1857
1862
|
return this._processor ? (_a = this._processor.getVar(variableName)) != null ? _a : null : null;
|
|
1858
1863
|
}
|
|
@@ -1998,8 +2003,8 @@ var JsPdfDynamo = class {
|
|
|
1998
2003
|
case "Include".toLowerCase():
|
|
1999
2004
|
yield this.includeFile(processor, parameters);
|
|
2000
2005
|
return;
|
|
2001
|
-
case "
|
|
2002
|
-
yield this.
|
|
2006
|
+
case "IncludeUrl".toLowerCase():
|
|
2007
|
+
yield this.includeUrl(processor, parameters);
|
|
2003
2008
|
return;
|
|
2004
2009
|
case "IncVar".toLowerCase():
|
|
2005
2010
|
processor.incVar(parameters);
|
|
@@ -2137,10 +2142,10 @@ var JsPdfDynamo = class {
|
|
|
2137
2142
|
}
|
|
2138
2143
|
});
|
|
2139
2144
|
}
|
|
2140
|
-
|
|
2145
|
+
includeUrl(processor, input) {
|
|
2141
2146
|
return __async(this, null, function* () {
|
|
2142
2147
|
const subs = processor.substitute(input);
|
|
2143
|
-
__privateGet(this, _appLogger).debug(`.
|
|
2148
|
+
__privateGet(this, _appLogger).debug(`.includeUrl ${subs}`);
|
|
2144
2149
|
try {
|
|
2145
2150
|
const response = yield fetch(subs, {
|
|
2146
2151
|
headers: { Accept: "text/plain;q=0.9, text/*;q=0.8, */*;q=0.7" }
|
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,18 @@ interface ILogger {
|
|
|
6
6
|
info: (message: string, ...args: any | null) => void;
|
|
7
7
|
trace: (message: string, ...args: any | null) => void;
|
|
8
8
|
warn: (message: string, ...args: any | null) => void;
|
|
9
|
-
|
|
9
|
+
}
|
|
10
|
+
declare class AppLogger implements ILogger {
|
|
11
|
+
private _logLevel;
|
|
12
|
+
private _logger;
|
|
13
|
+
constructor(logger?: ILogger | null);
|
|
14
|
+
trace(message: string, ...args: any | null): void;
|
|
15
|
+
debug(message: string, ...args: any | null): void;
|
|
16
|
+
info(message: string, ...args: any | null): void;
|
|
17
|
+
warn(message: string, ...args: any | null): void;
|
|
18
|
+
error(message: string, ...args: any | null): void;
|
|
19
|
+
logLevel(newLevel: string | number): void;
|
|
20
|
+
private canLog;
|
|
10
21
|
}
|
|
11
22
|
|
|
12
23
|
type fontStyleType = "bold" | "italic" | "normal" | "bolditalic";
|
|
@@ -291,7 +302,7 @@ declare class JsPdfProcessor {
|
|
|
291
302
|
get textColour(): string;
|
|
292
303
|
private set textColour(value);
|
|
293
304
|
private get pageCount();
|
|
294
|
-
constructor(options: Partial<IJsPdfOptions>, logger:
|
|
305
|
+
constructor(options: Partial<IJsPdfOptions>, logger: AppLogger);
|
|
295
306
|
private logAndParseCommand;
|
|
296
307
|
addBookmark(input: string): void;
|
|
297
308
|
addPage(input?: string): void;
|
|
@@ -354,8 +365,8 @@ declare class JsPdfDynamo {
|
|
|
354
365
|
_processor: JsPdfProcessor;
|
|
355
366
|
constructor(options?: Partial<IJsPdfOptions>, logger?: ILogger | null);
|
|
356
367
|
toBlob(): Blob | null;
|
|
357
|
-
toBlobUrl(): string | null;
|
|
358
|
-
|
|
368
|
+
toBlobUrl(fileName?: string): string | null;
|
|
369
|
+
getVariable(variableName: string): string | null;
|
|
359
370
|
private prepareNewPdf;
|
|
360
371
|
prepareWrappedString(input: string): string;
|
|
361
372
|
processCommands(commands: string[]): Promise<void>;
|
|
@@ -364,7 +375,7 @@ declare class JsPdfDynamo {
|
|
|
364
375
|
processGroups(processor: JsPdfProcessor, input: string, log?: boolean): Promise<void>;
|
|
365
376
|
private processGroupsRepeat;
|
|
366
377
|
private includeFile;
|
|
367
|
-
private
|
|
378
|
+
private includeUrl;
|
|
368
379
|
}
|
|
369
380
|
|
|
370
381
|
export { JsPdfDynamo };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,18 @@ interface ILogger {
|
|
|
6
6
|
info: (message: string, ...args: any | null) => void;
|
|
7
7
|
trace: (message: string, ...args: any | null) => void;
|
|
8
8
|
warn: (message: string, ...args: any | null) => void;
|
|
9
|
-
|
|
9
|
+
}
|
|
10
|
+
declare class AppLogger implements ILogger {
|
|
11
|
+
private _logLevel;
|
|
12
|
+
private _logger;
|
|
13
|
+
constructor(logger?: ILogger | null);
|
|
14
|
+
trace(message: string, ...args: any | null): void;
|
|
15
|
+
debug(message: string, ...args: any | null): void;
|
|
16
|
+
info(message: string, ...args: any | null): void;
|
|
17
|
+
warn(message: string, ...args: any | null): void;
|
|
18
|
+
error(message: string, ...args: any | null): void;
|
|
19
|
+
logLevel(newLevel: string | number): void;
|
|
20
|
+
private canLog;
|
|
10
21
|
}
|
|
11
22
|
|
|
12
23
|
type fontStyleType = "bold" | "italic" | "normal" | "bolditalic";
|
|
@@ -291,7 +302,7 @@ declare class JsPdfProcessor {
|
|
|
291
302
|
get textColour(): string;
|
|
292
303
|
private set textColour(value);
|
|
293
304
|
private get pageCount();
|
|
294
|
-
constructor(options: Partial<IJsPdfOptions>, logger:
|
|
305
|
+
constructor(options: Partial<IJsPdfOptions>, logger: AppLogger);
|
|
295
306
|
private logAndParseCommand;
|
|
296
307
|
addBookmark(input: string): void;
|
|
297
308
|
addPage(input?: string): void;
|
|
@@ -354,8 +365,8 @@ declare class JsPdfDynamo {
|
|
|
354
365
|
_processor: JsPdfProcessor;
|
|
355
366
|
constructor(options?: Partial<IJsPdfOptions>, logger?: ILogger | null);
|
|
356
367
|
toBlob(): Blob | null;
|
|
357
|
-
toBlobUrl(): string | null;
|
|
358
|
-
|
|
368
|
+
toBlobUrl(fileName?: string): string | null;
|
|
369
|
+
getVariable(variableName: string): string | null;
|
|
359
370
|
private prepareNewPdf;
|
|
360
371
|
prepareWrappedString(input: string): string;
|
|
361
372
|
processCommands(commands: string[]): Promise<void>;
|
|
@@ -364,7 +375,7 @@ declare class JsPdfDynamo {
|
|
|
364
375
|
processGroups(processor: JsPdfProcessor, input: string, log?: boolean): Promise<void>;
|
|
365
376
|
private processGroupsRepeat;
|
|
366
377
|
private includeFile;
|
|
367
|
-
private
|
|
378
|
+
private includeUrl;
|
|
368
379
|
}
|
|
369
380
|
|
|
370
381
|
export { JsPdfDynamo };
|
package/dist/index.js
CHANGED
|
@@ -89,9 +89,6 @@ var AppLogger = class {
|
|
|
89
89
|
this._logLevel = newLevel;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
if (this._logger.logLevel) {
|
|
93
|
-
this._logger.logLevel(this._logLevel);
|
|
94
|
-
}
|
|
95
92
|
}
|
|
96
93
|
canLog(level) {
|
|
97
94
|
return level >= this._logLevel;
|
|
@@ -328,8 +325,11 @@ var JsPdfProcessor = class {
|
|
|
328
325
|
this._variables.set("_DATEDMY", (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"));
|
|
329
326
|
this._variables.set("_PAGENO", "1");
|
|
330
327
|
this._variables.set("_PAGES", "1");
|
|
328
|
+
this.posnX = 0;
|
|
329
|
+
this.posnY = 0;
|
|
331
330
|
this.spaceHoz = 0;
|
|
332
331
|
this.spaceVert = 0;
|
|
332
|
+
this.currentPageNumber = 1;
|
|
333
333
|
this.lineWidth = this.pointsToUom(mmToPoints(0.2));
|
|
334
334
|
this.lineColour = "black";
|
|
335
335
|
this.fontPointSize = 12;
|
|
@@ -1164,10 +1164,16 @@ var JsPdfProcessor = class {
|
|
|
1164
1164
|
return;
|
|
1165
1165
|
}
|
|
1166
1166
|
let lastObjectHeight = 0;
|
|
1167
|
-
text = text.replace(
|
|
1167
|
+
text = text.replace(/\\[nN]/g, " \n") + " ";
|
|
1168
|
+
const splitText = text.split("\n");
|
|
1169
|
+
const lines = [];
|
|
1170
|
+
for (let line of splitText) {
|
|
1171
|
+
lines.push(...this._pdfDocument.splitTextToSize(line, maxWidth));
|
|
1172
|
+
}
|
|
1173
|
+
if (lines.length > splitText.length) {
|
|
1174
|
+
this._logger.trace(`Text was wrapped into ${lines.length} lines`, lines);
|
|
1175
|
+
}
|
|
1168
1176
|
this.posnY = top;
|
|
1169
|
-
const lines = this._pdfDocument.splitTextToSize(text, maxWidth) || [];
|
|
1170
|
-
this._logger.trace(`Text was wrapped into ${lines.length} lines`, lines);
|
|
1171
1177
|
while (lines.length > 0) {
|
|
1172
1178
|
if (!cmdGroup.startsWith("*")) {
|
|
1173
1179
|
yield jsPdfDynamo.processGroups(this, cmdGroup, false);
|
|
@@ -1809,12 +1815,11 @@ var JsPdfDynamo = class {
|
|
|
1809
1815
|
return null;
|
|
1810
1816
|
}
|
|
1811
1817
|
}
|
|
1812
|
-
toBlobUrl() {
|
|
1818
|
+
toBlobUrl(fileName) {
|
|
1813
1819
|
try {
|
|
1814
|
-
const result = this._processor.PdfDocument.output(
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
);
|
|
1820
|
+
const result = this._processor.PdfDocument.output("bloburi", {
|
|
1821
|
+
filename: fileName
|
|
1822
|
+
});
|
|
1818
1823
|
return result;
|
|
1819
1824
|
} catch (e) {
|
|
1820
1825
|
__privateGet(this, _appLogger).warn(
|
|
@@ -1823,7 +1828,7 @@ var JsPdfDynamo = class {
|
|
|
1823
1828
|
return null;
|
|
1824
1829
|
}
|
|
1825
1830
|
}
|
|
1826
|
-
|
|
1831
|
+
getVariable(variableName) {
|
|
1827
1832
|
var _a;
|
|
1828
1833
|
return this._processor ? (_a = this._processor.getVar(variableName)) != null ? _a : null : null;
|
|
1829
1834
|
}
|
|
@@ -1969,8 +1974,8 @@ var JsPdfDynamo = class {
|
|
|
1969
1974
|
case "Include".toLowerCase():
|
|
1970
1975
|
yield this.includeFile(processor, parameters);
|
|
1971
1976
|
return;
|
|
1972
|
-
case "
|
|
1973
|
-
yield this.
|
|
1977
|
+
case "IncludeUrl".toLowerCase():
|
|
1978
|
+
yield this.includeUrl(processor, parameters);
|
|
1974
1979
|
return;
|
|
1975
1980
|
case "IncVar".toLowerCase():
|
|
1976
1981
|
processor.incVar(parameters);
|
|
@@ -2108,10 +2113,10 @@ var JsPdfDynamo = class {
|
|
|
2108
2113
|
}
|
|
2109
2114
|
});
|
|
2110
2115
|
}
|
|
2111
|
-
|
|
2116
|
+
includeUrl(processor, input) {
|
|
2112
2117
|
return __async(this, null, function* () {
|
|
2113
2118
|
const subs = processor.substitute(input);
|
|
2114
|
-
__privateGet(this, _appLogger).debug(`.
|
|
2119
|
+
__privateGet(this, _appLogger).debug(`.includeUrl ${subs}`);
|
|
2115
2120
|
try {
|
|
2116
2121
|
const response = yield fetch(subs, {
|
|
2117
2122
|
headers: { Accept: "text/plain;q=0.9, text/*;q=0.8, */*;q=0.7" }
|
|
@@ -11,26 +11,29 @@
|
|
|
11
11
|
.DrawText 0 %_CurrentY% Commands are described in a following chapter.
|
|
12
12
|
|
|
13
13
|
.incCurrentY %_FontHeight%
|
|
14
|
-
.
|
|
15
|
-
.
|
|
14
|
+
.SetVar CommandLine1 Variables are referenced by enclosing them in percentage symbols. For example, to write some
|
|
15
|
+
.SetVar CommandLine1 %CommandLine1% text at the current position on the page the following DrawText command can be used:
|
|
16
|
+
.Do CommandLine1
|
|
16
17
|
.incCurrentY %_FontHeight%
|
|
17
18
|
.SetVar CommandLine1 .DrawText %%%%_CurrentX%%%% %%%%_CurrentY%%%% Hello World!
|
|
18
|
-
.Do CommandLine2
|
|
19
|
+
.Do CommandLine2
|
|
19
20
|
.incCurrentY %_FontHeight%
|
|
20
|
-
.
|
|
21
|
-
.
|
|
21
|
+
.SetVar CommandLine1 Variables (and commands) are not case sensitive and the above command could also be given as:
|
|
22
|
+
.Do CommandLine1
|
|
22
23
|
.incCurrentY %_FontHeight%
|
|
23
24
|
.SetVar CommandLine1 .drawTEXT %%%%_currentX%%%% %%%%_CURRENTy%%%% Hello World!
|
|
24
25
|
.Do CommandLine2
|
|
25
26
|
.incCurrentY %_FontHeight%
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
.
|
|
27
|
+
|
|
28
|
+
.SetVar CommandLine1 Variables are stored as strings though there is a limited capability to perform arithmetic on
|
|
29
|
+
.SetVar CommandLine1 %CommandLine1% variables. For example, the .IncVar command can be used to add or subtract a number from
|
|
30
|
+
.SetVar CommandLine1 %CommandLine1% a variable.
|
|
31
|
+
.Do CommandLine1
|
|
29
32
|
.incCurrentY %_FontHeight%
|
|
33
|
+
|
|
30
34
|
.DrawText 0 %_CurrentY% Variables do not have to be assigned a value before being used.
|
|
31
35
|
.DrawText 0 %_CurrentY% The value of a variable referenced before being assigned a value is an empty string.
|
|
32
36
|
.incCurrentY %_FontHeight%
|
|
33
|
-
.
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
+
.SetVar CommandLine1 All variables are global, there is no scoping of variables within a group. A variable
|
|
38
|
+
.SetVar CommandLine1 %CommandLine1% defined within a group is available to commands run after that group.
|
|
39
|
+
.Do CommandLine1
|
|
@@ -3,44 +3,44 @@
|
|
|
3
3
|
|
|
4
4
|
.incCurrentY %halfLineGap%
|
|
5
5
|
.SetVar text JsPdfDynamo maintains and updates various variables as each command is processed. These
|
|
6
|
-
.SetVar text %text% variables can not be changed directly by using the SetVar command.
|
|
7
|
-
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %
|
|
6
|
+
.SetVar text %text% variables can not be changed directly by using the SetVar command.
|
|
7
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
8
|
+
.incCurrentY %halfLineGap%
|
|
9
|
+
.SetVar text Note that unless otherwise stated, all distances and positions are in the unit of measure specified
|
|
10
|
+
.SetVar text %text% when creating the JsPdfDynamo object.
|
|
11
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
8
12
|
.incCurrentY %halfLineGap%
|
|
9
13
|
.SetMargin L 20
|
|
10
14
|
|
|
11
15
|
.SetVar CommandLine1 _CurrentX
|
|
12
|
-
.SetVar CommandLine2 The current horizontal position on the page, relative to the left margin
|
|
13
|
-
.Do VariableLine
|
|
14
|
-
.SetVar CommandLine2 millimeters.
|
|
16
|
+
.SetVar CommandLine2 The current horizontal position on the page, relative to the left margin.
|
|
15
17
|
.Do VariableLine
|
|
16
18
|
|
|
17
19
|
.incCurrentY %halfLineGap%
|
|
18
20
|
.SetVar CommandLine1 _CurrentY
|
|
19
|
-
.SetVar CommandLine2 The current vertical position on the page, relative to the top margin
|
|
20
|
-
.Do VariableLine
|
|
21
|
-
.SetVar CommandLine2 millimeters.
|
|
21
|
+
.SetVar CommandLine2 The current vertical position on the page, relative to the top margin.
|
|
22
22
|
.Do VariableLine
|
|
23
23
|
|
|
24
24
|
.incCurrentY %halfLineGap%
|
|
25
25
|
.SetVar CommandLine1 _CurrentPageSize
|
|
26
|
-
.SetVar CommandLine2 The name of the last page size specified, for example, '
|
|
26
|
+
.SetVar CommandLine2 The name of the last page size specified, for example, 'a4', 'letter'.
|
|
27
27
|
.Do VariableLineWide
|
|
28
28
|
|
|
29
29
|
.incCurrentY %halfLineGap%
|
|
30
30
|
.SetVar CommandLine1 _CurrentPageOrientation
|
|
31
|
-
.SetVar CommandLine2 The last page orientation specified:
|
|
32
|
-
.Do VariableLineWide
|
|
33
|
-
.SetVar CommandLine2 0=Portrait (default) 1=Landscape
|
|
31
|
+
.SetVar CommandLine2 The last page orientation specified: 'portrait' or 'landscape'
|
|
34
32
|
.Do VariableLineWide
|
|
35
33
|
|
|
36
34
|
.incCurrentY %halfLineGap%
|
|
37
35
|
.SetVar CommandLine1 _FontHeight
|
|
38
|
-
.SetVar CommandLine2 The height of the current font
|
|
39
|
-
.
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
.
|
|
43
|
-
.
|
|
36
|
+
.SetVar CommandLine2 The height of the current font. This can be used to create a space between
|
|
37
|
+
.SetVar CommandLine2 %CommandLine2% paragraphs when used in conjunction with the incCurrentY command.
|
|
38
|
+
.Do VariableLineWrapped
|
|
39
|
+
|
|
40
|
+
.incCurrentY %halfLineGap%
|
|
41
|
+
.SetVar CommandLine1 _FontName
|
|
42
|
+
.SetVar CommandLine2 The name of the current font. For example, "helvetica", which is the default font.
|
|
43
|
+
.Do VariableLineWrapped
|
|
44
44
|
|
|
45
45
|
.incCurrentY %halfLineGap%
|
|
46
46
|
.SetVar CommandLine1 _FontPointSize
|
|
@@ -52,16 +52,9 @@
|
|
|
52
52
|
.SetVar CommandLine2 The current font style. For example, "normal" or "italic".
|
|
53
53
|
.Do VariableLine
|
|
54
54
|
|
|
55
|
-
.incCurrentY %halfLineGap%
|
|
56
|
-
.SetVar CommandLine1 _FontType
|
|
57
|
-
.SetVar CommandLine2 The name of the current font. For example, "Helvetica", which is the
|
|
58
|
-
.Do VariableLine
|
|
59
|
-
.SetVar CommandLine2 default font type.
|
|
60
|
-
.Do VariableLine
|
|
61
|
-
|
|
62
55
|
.incCurrentY %halfLineGap%
|
|
63
56
|
.SetVar CommandLine1 _ImageHeight
|
|
64
|
-
.SetVar CommandLine2 The height of the last loaded image
|
|
57
|
+
.SetVar CommandLine2 The height of the last loaded image.
|
|
65
58
|
.Do VariableLine
|
|
66
59
|
|
|
67
60
|
.incCurrentY %halfLineGap%
|
|
@@ -71,7 +64,7 @@
|
|
|
71
64
|
|
|
72
65
|
.incCurrentY %halfLineGap%
|
|
73
66
|
.SetVar CommandLine1 _ImageWidth
|
|
74
|
-
.SetVar CommandLine2 The width of the last loaded image
|
|
67
|
+
.SetVar CommandLine2 The width of the last loaded image.
|
|
75
68
|
.Do VariableLine
|
|
76
69
|
|
|
77
70
|
.incCurrentY %halfLineGap%
|
|
@@ -81,7 +74,7 @@
|
|
|
81
74
|
|
|
82
75
|
.incCurrentY %halfLineGap%
|
|
83
76
|
.SetVar CommandLine1 _LastError
|
|
84
|
-
.SetVar CommandLine2 A description of the last error encountered.
|
|
77
|
+
.SetVar CommandLine2 A description of the last error encountered.
|
|
85
78
|
.Do VariableLine
|
|
86
79
|
|
|
87
80
|
.incCurrentY %halfLineGap%
|
|
@@ -95,50 +88,46 @@
|
|
|
95
88
|
|
|
96
89
|
.incCurrentY %halfLineGap%
|
|
97
90
|
.SetVar CommandLine1 _LastObjectHeight
|
|
98
|
-
.SetVar CommandLine2 The height of the last object that has been
|
|
91
|
+
.SetVar CommandLine2 The height of the last object that has been drawn.
|
|
99
92
|
.Do VariableLine
|
|
100
93
|
|
|
101
94
|
.incCurrentY %halfLineGap%
|
|
102
95
|
.SetVar CommandLine1 _LastObjectWidth
|
|
103
|
-
.SetVar CommandLine2 The width of the last object that has been
|
|
96
|
+
.SetVar CommandLine2 The width of the last object that has been drawn.
|
|
104
97
|
.Do VariableLine
|
|
105
98
|
|
|
106
99
|
.incCurrentY %halfLineGap%
|
|
107
100
|
.SetVar CommandLine1 _LastOutline
|
|
108
101
|
.SetVar CommandLine2 This contains the number assigned to each outline entry when it is
|
|
109
|
-
.
|
|
110
|
-
.
|
|
111
|
-
.Do VariableLine
|
|
102
|
+
.SetVar CommandLine2 %CommandLine2% created. This is used when creating child outline entries.
|
|
103
|
+
.Do VariableLineWrapped
|
|
112
104
|
|
|
113
105
|
.incCurrentY %halfLineGap%
|
|
114
106
|
.SetVar CommandLine1 _LastResult
|
|
115
107
|
.SetVar CommandLine2 Most commands update this variable. If the command fails, this will be
|
|
116
|
-
.
|
|
117
|
-
.SetVar CommandLine2
|
|
118
|
-
.
|
|
119
|
-
.
|
|
120
|
-
.Do VariableLine
|
|
121
|
-
.SetVar CommandLine2 is returned in this variable.
|
|
122
|
-
.Do VariableLine
|
|
108
|
+
.SetVar CommandLine2 %CommandLine2% set to '0'. A successful command will set this to '1' or to some other
|
|
109
|
+
.SetVar CommandLine2 %CommandLine2% useful value. For example, when a new page is added, _LastResult
|
|
110
|
+
.SetVar CommandLine2 %CommandLine2% will contain the number of the added page.
|
|
111
|
+
.Do VariableLineWrapped
|
|
123
112
|
|
|
124
113
|
.incCurrentY %halfLineGap%
|
|
125
114
|
.SetVar CommandLine1 _MarginBottom
|
|
126
|
-
.SetVar CommandLine2 The current margin
|
|
115
|
+
.SetVar CommandLine2 The current margin from the bottom edge of the page.
|
|
127
116
|
.Do VariableLine
|
|
128
117
|
|
|
129
118
|
.incCurrentY %halfLineGap%
|
|
130
119
|
.SetVar CommandLine1 _MarginLeft
|
|
131
|
-
.SetVar CommandLine2 The current margin
|
|
120
|
+
.SetVar CommandLine2 The current margin from the left edge of the page.
|
|
132
121
|
.Do VariableLine
|
|
133
122
|
|
|
134
123
|
.incCurrentY %halfLineGap%
|
|
135
124
|
.SetVar CommandLine1 _MarginRight
|
|
136
|
-
.SetVar CommandLine2 The current margin
|
|
125
|
+
.SetVar CommandLine2 The current margin from the right edge of the page.
|
|
137
126
|
.Do VariableLine
|
|
138
127
|
|
|
139
128
|
.incCurrentY %halfLineGap%
|
|
140
129
|
.SetVar CommandLine1 _MarginTop
|
|
141
|
-
.SetVar CommandLine2 The current margin
|
|
130
|
+
.SetVar CommandLine2 The current margin from the top edge of the page.
|
|
142
131
|
.Do VariableLine
|
|
143
132
|
|
|
144
133
|
.incCurrentY %halfLineGap%
|
|
@@ -148,9 +137,7 @@
|
|
|
148
137
|
|
|
149
138
|
.incCurrentY %halfLineGap%
|
|
150
139
|
.SetVar CommandLine1 _PageHeight
|
|
151
|
-
.SetVar CommandLine2 The height of the page, less the current top and bottom margins
|
|
152
|
-
.Do VariableLine
|
|
153
|
-
.SetVar CommandLine2 expressed in millimeters.
|
|
140
|
+
.SetVar CommandLine2 The height of the page, less the current top and bottom margins.
|
|
154
141
|
.Do VariableLine
|
|
155
142
|
|
|
156
143
|
.incCurrentY %halfLineGap%
|
|
@@ -160,31 +147,23 @@
|
|
|
160
147
|
|
|
161
148
|
.incCurrentY %halfLineGap%
|
|
162
149
|
.SetVar CommandLine1 _PageWidth
|
|
163
|
-
.SetVar CommandLine2 The width of the page, less the current left and right margins
|
|
164
|
-
.Do VariableLine
|
|
165
|
-
.SetVar CommandLine2 in millimeters.
|
|
150
|
+
.SetVar CommandLine2 The width of the page, less the current left and right margins.
|
|
166
151
|
.Do VariableLine
|
|
167
152
|
|
|
168
153
|
.incCurrentY %halfLineGap%
|
|
169
154
|
.SetVar CommandLine1 _SpaceHoz
|
|
170
155
|
.SetVar CommandLine2 JsPdfDynamo keeps track of the current position, relative to the left
|
|
171
|
-
.
|
|
172
|
-
.SetVar CommandLine2
|
|
173
|
-
.
|
|
174
|
-
.
|
|
175
|
-
.Do VariableLine
|
|
176
|
-
.SetVar CommandLine2 which can be set with the SetSpaceHoz command.
|
|
177
|
-
.Do VariableLine
|
|
156
|
+
.SetVar CommandLine2 %CommandLine2% margin, after each object is output. This position is calculated
|
|
157
|
+
.SetVar CommandLine2 %CommandLine2% from the width of the object plus the current horizontal spacing,
|
|
158
|
+
.SetVar CommandLine2 %CommandLine2% which can be set with the SetSpaceHoz command.
|
|
159
|
+
.Do VariableLineWrapped
|
|
178
160
|
|
|
179
161
|
.incCurrentY %halfLineGap%
|
|
180
162
|
.SetVar CommandLine1 _SpaceVert
|
|
181
|
-
.SetVar CommandLine2 JsPdfDynamo keeps track of the current position,
|
|
182
|
-
.
|
|
183
|
-
.SetVar CommandLine2
|
|
184
|
-
.
|
|
185
|
-
.
|
|
186
|
-
.Do VariableLine
|
|
187
|
-
.SetVar CommandLine2 be set with the SetSpaceVert command.
|
|
188
|
-
.Do VariableLine
|
|
163
|
+
.SetVar CommandLine2 %CommandLine2% JsPdfDynamo keeps track of the current position, relative
|
|
164
|
+
.SetVar CommandLine2 %CommandLine2% to the top margin, after each object is output. This position is calculated
|
|
165
|
+
.SetVar CommandLine2 %CommandLine2% from the height of the object plus the current vertical spacing, which can
|
|
166
|
+
.SetVar CommandLine2 %CommandLine2% be set with the SetSpaceVert command.
|
|
167
|
+
.Do VariableLineWrapped
|
|
189
168
|
.incCurrentY %_SPACEVERT%
|
|
190
169
|
.Do SetMargins
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
.SetVar CommandLine1 Create a top level bookmark entry for the current page:
|
|
35
35
|
.Do CommandLine
|
|
36
36
|
.incCurrentY %halfLineGap%
|
|
37
|
-
.SetVar CommandLine1 .AddBookmark
|
|
37
|
+
.SetVar CommandLine1 .AddBookmark 0 %%%%_PAGENO%%%% Chapter one of the document
|
|
38
38
|
.Do CommandLine2
|
|
39
|
-
.SetVar CommandLine1 .SetVar
|
|
39
|
+
.SetVar CommandLine1 .SetVar Chapter1 %%%%_LastResult%%%%
|
|
40
40
|
.Do CommandLine2
|
|
41
41
|
.incCurrentY %_FontHeight%
|
|
42
42
|
.SetVar CommandLine1 Create a child bookmark entry for the chapter 1:
|
|
43
43
|
.Do CommandLine
|
|
44
44
|
.incCurrentY %halfLineGap%
|
|
45
|
-
.SetVar CommandLine1 .AddBookmark
|
|
45
|
+
.SetVar CommandLine1 .AddBookmark %%%%Chapter1%%%% %%%%_PAGENO%%%% Chapter one, Paragraph 1
|
|
46
46
|
.Do CommandLine2
|
|
47
47
|
.incCurrentY %_FontHeight%
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
.SetVar CommandLine1 Read a logo from an image and add it to the top left of the current page.
|
|
45
45
|
.Do CommandLine
|
|
46
46
|
.incCurrentY %halfLineGap%
|
|
47
|
-
.SetVar CommandLine1 .AddImageFromFile
|
|
47
|
+
.SetVar CommandLine1 .AddImageFromFile ../images/myLogo.jpg
|
|
48
48
|
.Do CommandLine2
|
|
49
|
-
.SetVar CommandLine1 .SetVar
|
|
49
|
+
.SetVar CommandLine1 .SetVar IdLogo %%%%_LastImageAdded%%%%
|
|
50
50
|
.Do CommandLine2
|
|
51
|
-
.SetVar CommandLine1 .DrawImage
|
|
51
|
+
.SetVar CommandLine1 .DrawImage %%%%IdLogo%%%% 0 0 1
|
|
52
52
|
.Do CommandLine2
|
|
53
53
|
.incCurrentY %_FontHeight%
|
|
54
54
|
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
.SetVar CommandLine1 Read a logo from an image and add it to the top left of the current page.
|
|
45
45
|
.Do CommandLine
|
|
46
46
|
.incCurrentY %halfLineGap%
|
|
47
|
-
.SetVar CommandLine1 .AddImageFromUrl
|
|
47
|
+
.SetVar CommandLine1 .AddImageFromUrl /images/logo.png
|
|
48
48
|
.Do CommandLine2
|
|
49
|
-
.SetVar CommandLine1 .SetVar
|
|
49
|
+
.SetVar CommandLine1 .SetVar IdLogo %%%%_LastImageAdded%%%%
|
|
50
50
|
.Do CommandLine2
|
|
51
|
-
.SetVar CommandLine1 .DrawImage
|
|
51
|
+
.SetVar CommandLine1 .DrawImage %%%%IdLogo%%%% 0 0 1
|
|
52
52
|
.Do CommandLine2
|
|
53
53
|
.incCurrentY %_FontHeight%
|
|
54
54
|
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
.SetVar CommandLine1 %CommandLine1% is within 10mm of the bottom margin and create a new page if so:
|
|
39
39
|
.Do CommandLine
|
|
40
40
|
.incCurrentY %halfLineGap%
|
|
41
|
-
.SetVar CommandLine1 .CheckPage
|
|
41
|
+
.SetVar CommandLine1 .CheckPage 10
|
|
42
42
|
.Do CommandLine2
|
|
43
43
|
.incCurrentY %_FontHeight%
|
|
44
44
|
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
.SetVar CommandLine1 %CommandLine1% process the groups PageFooter, AddPage and GroupHeadingContinued:
|
|
48
48
|
.Do CommandLine
|
|
49
49
|
.incCurrentY %halfLineGap%
|
|
50
|
-
.SetVar CommandLine1 .CHECKPAGE
|
|
50
|
+
.SetVar CommandLine1 .CHECKPAGE 1.25 PageFooter AddPage GroupHeadingContinued
|
|
51
51
|
.Do CommandLine2
|
|
52
52
|
.incCurrentY %_FontHeight%
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
.SetVar ChapterName Commands
|
|
2
|
+
.do ChapterHeading
|
|
3
|
+
|
|
4
|
+
.SetVar text Note that unless otherwise stated, all distances and positions are in the unit of measure specified
|
|
5
|
+
.SetVar text %text% when creating the JsPdfDynamo object.
|
|
6
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
7
|
+
.incCurrentY %_FontHeight%
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
.SetVar CommandLine1 Set the variable 'SaveCurrentTop' to the system maintained variable '_CurrentY':
|
|
34
34
|
.Do CommandLine
|
|
35
35
|
.incCurrentY %halfLineGap%
|
|
36
|
-
.SetVar CommandLine1 .CopyVar
|
|
36
|
+
.SetVar CommandLine1 .CopyVar SaveCurrentTop _CurrentY
|
|
37
37
|
.Do CommandLine2
|
|
38
38
|
.incCurrentY %_FontHeight%
|
|
39
39
|
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
.SetVar CommandLine1 Process the groups 'NewChapter' and 'NewSection':
|
|
24
24
|
.Do CommandLine
|
|
25
25
|
.incCurrentY %halfLineGap%
|
|
26
|
-
.SetVar CommandLine1 .Do
|
|
26
|
+
.SetVar CommandLine1 .Do NewChapter NewSection
|
|
27
27
|
.Do CommandLine2
|
|
28
28
|
.incCurrentY %_FontHeight%
|
|
29
29
|
.SetVar CommandLine1 Process the group whose name is stored in the variable 'NextGroup':
|
|
30
30
|
.Do CommandLine
|
|
31
31
|
.incCurrentY %halfLineGap%
|
|
32
|
-
.SetVar CommandLine1 .Do
|
|
32
|
+
.SetVar CommandLine1 .Do %%%%NextGroup%%%%
|
|
33
33
|
.Do CommandLine2
|
|
34
34
|
.incCurrentY %_FontHeight%
|
|
35
35
|
|