jspdf-dynamo 1.0.5 → 1.0.7

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.
Files changed (36) hide show
  1. package/README.md +3 -3
  2. package/dist/index.cjs +199 -33
  3. package/dist/index.d.cts +14 -10
  4. package/dist/index.d.ts +14 -10
  5. package/dist/index.js +199 -33
  6. package/documentation/1. Introduction/Introduction.txt +1 -1
  7. package/documentation/3. Variables/Introduction.txt +13 -12
  8. package/documentation/3. Variables/SystemMaintained.txt +40 -0
  9. package/documentation/4. Commands/DrawBox.txt +6 -9
  10. package/documentation/4. Commands/DrawCircle.txt +71 -0
  11. package/documentation/4. Commands/DrawEllipse.txt +75 -0
  12. package/documentation/4. Commands/DrawTextWrapped.txt +1 -1
  13. package/documentation/4. Commands/IfBlank.txt +9 -14
  14. package/documentation/4. Commands/IfEq.txt +3 -2
  15. package/documentation/4. Commands/IfGt.txt +2 -1
  16. package/documentation/4. Commands/IfNe.txt +54 -0
  17. package/documentation/4. Commands/IfNotBlank.txt +9 -13
  18. package/documentation/4. Commands/LoadImageFromFile.txt +2 -2
  19. package/documentation/4. Commands/LoadImageFromUrl.txt +2 -2
  20. package/documentation/4. Commands/SetFillColour.txt +4 -2
  21. package/documentation/4. Commands/SetFontName.txt +80 -1
  22. package/documentation/4. Commands/SetFontSize.txt +43 -1
  23. package/documentation/4. Commands/SetFontStyle.txt +4 -5
  24. package/documentation/4. Commands/SetLineColour.txt +5 -2
  25. package/documentation/4. Commands/SetTextColour.txt +4 -2
  26. package/documentation/5. Other Definitions/pageSizes.txt +3 -3
  27. package/documentation/Documentation.pdf +0 -0
  28. package/documentation/documentation.txt +3 -0
  29. package/examples/1.Simple/simple.pdf +18 -186
  30. package/examples/2.Invoice/data.txt +21 -0
  31. package/examples/2.Invoice/gearz.png +0 -0
  32. package/examples/2.Invoice/invoice.pdf +0 -0
  33. package/examples/2.Invoice/invoice.spec.ts +62 -0
  34. package/examples/2.Invoice/parts.json +324 -0
  35. package/examples/2.Invoice/template.txt +136 -0
  36. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -46,19 +46,19 @@ var AppLogger = class {
46
46
  this._logger = console;
47
47
  }
48
48
  }
49
- trace(message, ...args) {
49
+ trace(message, args) {
50
50
  this.canLog(0) ? this._logger.trace(message, args) : null;
51
51
  }
52
- debug(message, ...args) {
52
+ debug(message, args) {
53
53
  this.canLog(1) ? this._logger.debug(message, args) : null;
54
54
  }
55
- info(message, ...args) {
55
+ info(message, args) {
56
56
  this.canLog(2) ? this._logger.info(message, args) : null;
57
57
  }
58
- warn(message, ...args) {
58
+ warn(message, args) {
59
59
  this.canLog(3) ? this._logger.warn(message, args) : null;
60
60
  }
61
- error(message, ...args) {
61
+ error(message, args) {
62
62
  this.canLog(4) ? this._logger.error(message, args) : null;
63
63
  }
64
64
  logLevel(newLevel) {
@@ -235,6 +235,8 @@ function isValidFontStyle(fontStyle) {
235
235
  // src/models/jsPdfOptions.ts
236
236
  var JsPdfOptions = class {
237
237
  constructor(options = {}) {
238
+ this.compress = true;
239
+ this.putOnlyUsedFonts = true;
238
240
  var _a, _b, _c;
239
241
  this.pageSize = ((_a = options.pageSize) == null ? void 0 : _a.toLocaleLowerCase()) || "a4";
240
242
  this.orientation = ((_b = options.orientation) == null ? void 0 : _b.toLocaleLowerCase()) || "portrait";
@@ -314,15 +316,32 @@ var JsPdfProcessor = class {
314
316
  this.pageOrientation = optn.orientation;
315
317
  this.currentUom = optn.unit;
316
318
  this._pdfDocument.setLineHeightFactor(1);
319
+ const now = /* @__PURE__ */ new Date();
317
320
  this._variables.set(
318
321
  "_TIMEHM",
319
- (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
322
+ now.toLocaleTimeString(void 0, {
320
323
  hour12: false,
321
324
  hour: "2-digit",
322
325
  minute: "2-digit"
323
326
  })
324
327
  );
325
- this._variables.set("_DATEDMY", (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"));
328
+ this._variables.set(
329
+ "_DATEDDMMYYYY",
330
+ now.toLocaleDateString("en-GB", {
331
+ day: "2-digit",
332
+ month: "2-digit",
333
+ year: "numeric"
334
+ })
335
+ );
336
+ this._variables.set(
337
+ "_DATEMMDDYYYY",
338
+ now.toLocaleDateString("en-US", {
339
+ day: "2-digit",
340
+ month: "2-digit",
341
+ year: "numeric"
342
+ })
343
+ );
344
+ this._variables.set("_DATEISO", now.toISOString().substring(0, 10));
326
345
  this._variables.set("_IMAGEASPECT", "1");
327
346
  this._variables.set("_IMAGEHEIGHT", "0");
328
347
  this._variables.set("_IMAGEHEIGHTPX", "0");
@@ -794,6 +813,16 @@ var JsPdfProcessor = class {
794
813
  if (!this.checkPosition(left, top)) {
795
814
  return;
796
815
  }
816
+ if (isNaN(width)) {
817
+ this.lastError = `The width of the box is not a number`;
818
+ this.lastResult = "0";
819
+ return;
820
+ }
821
+ if (isNaN(height)) {
822
+ this.lastError = `The height of the box is not a number`;
823
+ this.lastResult = "0";
824
+ return;
825
+ }
797
826
  this.posnX = left;
798
827
  this.posnY = top;
799
828
  let lineWidthAdjustment = this._lineWidth;
@@ -814,6 +843,10 @@ var JsPdfProcessor = class {
814
843
  style = "FD";
815
844
  this._pdfDocument.setFillColor(this.fillColour);
816
845
  break;
846
+ default:
847
+ this.lastError = `The box style option '${boxType}' is not valid. It must be '0', '1' or '2'`;
848
+ this.lastResult = "0";
849
+ return;
817
850
  }
818
851
  this._pdfDocument.rect(x, y, w, h, style);
819
852
  this.posnX = this.posnX + width + this.spaceHoz;
@@ -822,10 +855,57 @@ var JsPdfProcessor = class {
822
855
  this.lastObjectWidth = width;
823
856
  this.lastResult = "1";
824
857
  }
858
+ drawCircle(input) {
859
+ const subs = this.logAndParseCommand(".drawCircle", input);
860
+ const { first: left, rest: rest1 } = getNextNumber(subs);
861
+ const { first: top, rest: rest2 } = getNextNumber(rest1);
862
+ const { first: radius, rest: rest3 } = getNextNumber(rest2);
863
+ const { first: option } = getNextNumber(rest3);
864
+ if (!this.checkPosition(left, top)) {
865
+ return;
866
+ }
867
+ if (isNaN(radius)) {
868
+ this.lastError = `The radius of the circle is not a number`;
869
+ this.lastResult = "0";
870
+ return;
871
+ }
872
+ this.posnX = left;
873
+ this.posnY = top;
874
+ const x = this.posnX + this._marginLeft;
875
+ const y = this.posnY + this._marginTop;
876
+ let r = radius;
877
+ let style = "S";
878
+ switch (option) {
879
+ case 0:
880
+ r -= this._lineWidth * 0.5;
881
+ break;
882
+ case 1:
883
+ style = "F";
884
+ this._pdfDocument.setFillColor(this.fillColour);
885
+ break;
886
+ case 2:
887
+ style = "FD";
888
+ this._pdfDocument.setFillColor(this.fillColour);
889
+ r -= this._lineWidth * 0.5;
890
+ break;
891
+ default:
892
+ this.lastError = `The circle style option '${option}' is not valid. It must be '0', '1' or '2'`;
893
+ this.lastResult = "0";
894
+ return;
895
+ }
896
+ this._pdfDocument.circle(x, y, r, style);
897
+ this.lastObjectHeight = radius * 2;
898
+ this.lastObjectWidth = this.lastObjectHeight;
899
+ this.posnX = this.posnX + radius + this.spaceHoz;
900
+ this.posnY = this.posnY + radius + this.spaceVert;
901
+ this.lastResult = "1";
902
+ }
825
903
  drawDebugGrid(input) {
826
904
  const subs = this.logAndParseCommand(".drawDebugGrid", input);
827
905
  const savedLineColour = this.lineColour;
828
906
  const savedLineWidth = this.lineWidth;
907
+ const savedX = this.posnX;
908
+ const savedY = this.posnY;
829
909
  const mm = 0.1;
830
910
  const pts = mmToPoints(mm);
831
911
  const lineWidth = this.pointsToUom(pts);
@@ -882,6 +962,62 @@ var JsPdfProcessor = class {
882
962
  }
883
963
  this.lineColour = savedLineColour;
884
964
  this.lineWidth = savedLineWidth;
965
+ this.posnX = savedX;
966
+ this.posnY = savedY;
967
+ }
968
+ drawEllipse(input) {
969
+ const subs = this.logAndParseCommand(".drawEllipse", input);
970
+ const { first: left, rest: rest1 } = getNextNumber(subs);
971
+ const { first: top, rest: rest2 } = getNextNumber(rest1);
972
+ const { first: radiusX, rest: rest3 } = getNextNumber(rest2);
973
+ const { first: radiusY, rest: rest4 } = getNextNumber(rest3);
974
+ const { first: option } = getNextNumber(rest4);
975
+ if (!this.checkPosition(left, top)) {
976
+ return;
977
+ }
978
+ if (isNaN(radiusX)) {
979
+ this.lastError = `The horizontal radius of the ellipse is not a number`;
980
+ this.lastResult = "0";
981
+ return;
982
+ }
983
+ if (isNaN(radiusY)) {
984
+ this.lastError = `The vertical radius of the ellipse is not a number`;
985
+ this.lastResult = "0";
986
+ return;
987
+ }
988
+ this.posnX = left;
989
+ this.posnY = top;
990
+ const x = this.posnX + this._marginLeft;
991
+ const y = this.posnY + this._marginTop;
992
+ let rx = radiusX;
993
+ let ry = radiusY;
994
+ let style = "S";
995
+ switch (option) {
996
+ case 0:
997
+ rx -= this._lineWidth * 0.5;
998
+ ry -= this._lineWidth * 0.5;
999
+ break;
1000
+ case 1:
1001
+ style = "F";
1002
+ this._pdfDocument.setFillColor(this.fillColour);
1003
+ break;
1004
+ case 2:
1005
+ style = "FD";
1006
+ this._pdfDocument.setFillColor(this.fillColour);
1007
+ rx -= this._lineWidth * 0.5;
1008
+ ry -= this._lineWidth * 0.5;
1009
+ break;
1010
+ default:
1011
+ this.lastError = `The circle style option '${option}' is not valid. It must be '0', '1' or '2'`;
1012
+ this.lastResult = "0";
1013
+ return;
1014
+ }
1015
+ this._pdfDocument.ellipse(x, y, rx, ry, style);
1016
+ this.lastObjectHeight = radiusY * 2;
1017
+ this.lastObjectWidth = radiusX * 2;
1018
+ this.posnX = this.posnX + radiusX + this.spaceHoz;
1019
+ this.posnY = this.posnY + radiusY + this.spaceVert;
1020
+ this.lastResult = "1";
885
1021
  }
886
1022
  drawLine(input) {
887
1023
  const subs = this.logAndParseCommand(".drawLine", input);
@@ -921,7 +1057,7 @@ var JsPdfProcessor = class {
921
1057
  return;
922
1058
  }
923
1059
  if (isNaN(imageNo) || imageNo < 0 || imageNo > this._images.length - 1) {
924
- this.lastError = this._images.length ? "The image number must be in the range of 0 to " + (this._images.length - 1).toString() : "Only one image has been loaded, the image number can only be 0";
1060
+ this.lastError = this._images.length > 1 ? `The image number ${imageNo} must be in the range of 0 to ${(this._images.length - 1).toString()}` : "Only one image has been loaded, the image number can only be 0";
925
1061
  this.lastResult = "0";
926
1062
  return;
927
1063
  }
@@ -972,7 +1108,6 @@ var JsPdfProcessor = class {
972
1108
  this.lastResult = "1";
973
1109
  }
974
1110
  drawText(input) {
975
- var _a;
976
1111
  const subs = this.logAndParseCommand(".drawText", input);
977
1112
  const { first: left, rest: rest1 } = getNextNumber(subs);
978
1113
  const { first: top, rest: rest2 } = getNextNumber(rest1);
@@ -984,7 +1119,7 @@ var JsPdfProcessor = class {
984
1119
  this.lastObjectWidth = 0;
985
1120
  this.lastResult = "1";
986
1121
  if (lines.length > 1) {
987
- this.lastError = `Text was truncated to fit within the available width (${(_a = lines[0]) == null ? void 0 : _a.substring(0, 20)}...)`;
1122
+ this.lastError = `Text was truncated to fit within the available width (${rest2.substring(0, 20)}...) on page ${this._currentPageNumber}.`;
988
1123
  this.lastResult = "0";
989
1124
  if (lines[0]) {
990
1125
  if (this._pdfDocument.getTextWidth(lines[0]) < maxWidth) {
@@ -1290,10 +1425,11 @@ var JsPdfProcessor = class {
1290
1425
  }
1291
1426
  ifNotBlank(jsPdfDynamo, input) {
1292
1427
  return __async(this, null, function* () {
1293
- let { first: variable, rest } = getNextString(input);
1428
+ let { first: value1, rest } = getNextString(input);
1294
1429
  const subs = this.substitute(rest.trim());
1295
- this._logger.debug(".ifNotBlank " + variable + " " + subs);
1296
- let value = this._variables.get(variable.toLocaleUpperCase()) || "";
1430
+ this._logger.debug(".ifNotBlank " + value1 + " " + subs);
1431
+ const variable1 = this.substitute(value1);
1432
+ let value = this._variables.get(variable1.toLocaleUpperCase()) || "";
1297
1433
  this.lastResult = "-1";
1298
1434
  if (value.trim() !== "") {
1299
1435
  yield jsPdfDynamo.processDot(this, rest);
@@ -1547,9 +1683,14 @@ var JsPdfProcessor = class {
1547
1683
  }
1548
1684
  }
1549
1685
  setFillColour(input) {
1550
- let subs = this.substitute(input);
1551
- this._logger.debug(".setFillColour " + subs);
1552
- this.fillColour = subs;
1686
+ const subs = this.logAndParseCommand(".setFillColour", input);
1687
+ const { first: fillColour } = getNextString(subs);
1688
+ if (fillColour === "") {
1689
+ this.lastResult = "0";
1690
+ this.lastError = "A fill colour must be specified";
1691
+ return;
1692
+ }
1693
+ this.fillColour = fillColour;
1553
1694
  this.lastResult = "1";
1554
1695
  }
1555
1696
  setFontName(input) {
@@ -1565,14 +1706,25 @@ var JsPdfProcessor = class {
1565
1706
  }
1566
1707
  setFontSize(input) {
1567
1708
  const subs = this.logAndParseCommand(".setFontSize", input);
1568
- let { first: size } = getNextNumber(subs);
1569
- if (size > 0) {
1570
- this.fontPointSize = size;
1571
- this.lastResult = "1";
1572
- } else {
1709
+ if (subs === "") {
1573
1710
  this.lastResult = "0";
1574
- this.lastError = "Invalid font size " + size;
1711
+ this.lastError = "A font size must be specified";
1712
+ return;
1575
1713
  }
1714
+ let { first: sizeAlpha } = getNextNumber(subs);
1715
+ const size = Number(sizeAlpha);
1716
+ if (Number.isNaN(size)) {
1717
+ this.lastResult = "0";
1718
+ this.lastError = `A font size must be a number. '${sizeAlpha}' is not a number.`;
1719
+ return;
1720
+ }
1721
+ if (size <= 0) {
1722
+ this.lastResult = "0";
1723
+ this.lastError = "A font size must be greater than 0";
1724
+ return;
1725
+ }
1726
+ this.fontPointSize = size;
1727
+ this.lastResult = "1";
1576
1728
  }
1577
1729
  setFontStyle(input) {
1578
1730
  const subs = this.logAndParseCommand(".setFontStyle", input);
@@ -1591,9 +1743,14 @@ var JsPdfProcessor = class {
1591
1743
  this.lastResult = "1";
1592
1744
  }
1593
1745
  setLineColour(input) {
1594
- let subs = this.substitute(input);
1595
- this._logger.debug(".setLineColour " + subs);
1596
- this.lineColour = subs;
1746
+ const subs = this.logAndParseCommand(".setFontStyle", input);
1747
+ const { first: lineColour } = getNextString(subs);
1748
+ if (lineColour === "") {
1749
+ this.lastResult = "0";
1750
+ this.lastError = "A line colour must be specified";
1751
+ return;
1752
+ }
1753
+ this.lineColour = lineColour;
1597
1754
  this.lastResult = "1";
1598
1755
  }
1599
1756
  setLineWidth(input) {
@@ -1699,7 +1856,13 @@ var JsPdfProcessor = class {
1699
1856
  }
1700
1857
  setTextColour(input) {
1701
1858
  const subs = this.logAndParseCommand(".setTextColour", input);
1702
- this.textColour = subs;
1859
+ const { first: textColour } = getNextString(subs);
1860
+ if (textColour === "") {
1861
+ this.lastResult = "0";
1862
+ this.lastError = "A text colour must be specified";
1863
+ return;
1864
+ }
1865
+ this.textColour = textColour;
1703
1866
  this.lastResult = "1";
1704
1867
  }
1705
1868
  copyVar(input) {
@@ -1913,10 +2076,6 @@ var JsPdfDynamo = class {
1913
2076
  if (currLine.startsWith("[")) {
1914
2077
  if (inGroupLoading) {
1915
2078
  inGroupLoading = false;
1916
- __privateGet(this, _appLogger).debug(
1917
- `Finished loading group ${grpName} (${currLine})
1918
- `
1919
- );
1920
2079
  } else {
1921
2080
  if (currLine.length === 1) continue;
1922
2081
  grpName = currLine.substring(1);
@@ -1926,8 +2085,7 @@ var JsPdfDynamo = class {
1926
2085
  }
1927
2086
  grpName = grpName.trim().toLocaleUpperCase();
1928
2087
  inGroupLoading = true;
1929
- __privateGet(this, _appLogger).debug(`Loading group ${grpName} (${currLine})
1930
- `);
2088
+ __privateGet(this, _appLogger).debug(`Loading group ${grpName}`);
1931
2089
  currGroup = [];
1932
2090
  __privateGet(this, _groups)[grpName] = currGroup;
1933
2091
  }
@@ -1978,9 +2136,15 @@ var JsPdfDynamo = class {
1978
2136
  case "DrawBox".toLowerCase():
1979
2137
  processor.drawBox(parameters);
1980
2138
  return;
2139
+ case "DrawCircle".toLowerCase():
2140
+ processor.drawCircle(parameters);
2141
+ return;
1981
2142
  case "DrawDebugGrid".toLowerCase():
1982
2143
  processor.drawDebugGrid(parameters);
1983
2144
  return;
2145
+ case "DrawEllipse".toLowerCase():
2146
+ processor.drawEllipse(parameters);
2147
+ return;
1984
2148
  case "DrawImage".toLowerCase():
1985
2149
  processor.drawImage(parameters);
1986
2150
  return;
@@ -2111,9 +2275,11 @@ var JsPdfDynamo = class {
2111
2275
  let { first: group, rest } = getNextString(subs);
2112
2276
  subs = rest;
2113
2277
  __privateGet(this, _appLogger).debug(`
2114
- [${group}]`);
2278
+ [${group} - Enter]`);
2115
2279
  if (__privateGet(this, _groups)[group]) {
2116
2280
  yield this.processTemplate(processor, __privateGet(this, _groups)[group]);
2281
+ __privateGet(this, _appLogger).debug(`[${group} - Exit]
2282
+ `);
2117
2283
  } else {
2118
2284
  __privateGet(this, _appLogger).warn(`Group ${group} was not found.`);
2119
2285
  processor.lastResult = "0";
@@ -42,7 +42,7 @@
42
42
 
43
43
  .SetVar top %_CurrentY%
44
44
  .DrawText 5 %top% -
45
- .SetVar text The initial page size, orientation and units of measure are set when the
45
+ .SetVar text The initial page size, orientation and unit of measure are set when the
46
46
  .SetVar text %text% JsPdfDynamo instance is instantiated.
47
47
  .DrawTextWrapped 10 %top% %width% *None %text%
48
48
 
@@ -10,30 +10,31 @@
10
10
  .incCurrentY %halfLineGap%
11
11
  .DrawText 0 %_CurrentY% Commands are described in a following chapter.
12
12
 
13
- .incCurrentY %_FontHeight%
13
+ .incCurrentY %halfLineGap%
14
14
  .SetVar CommandLine1 Variables are referenced by enclosing them in percentage symbols. For example, to write some
15
15
  .SetVar CommandLine1 %CommandLine1% text at the current position on the page the following DrawText command can be used:
16
- .Do CommandLine1
17
- .incCurrentY %_FontHeight%
16
+ .Do CommandLine
17
+ .incCurrentY %halfLineGap%
18
18
  .SetVar CommandLine1 .DrawText %%%%_CurrentX%%%% %%%%_CurrentY%%%% Hello World!
19
19
  .Do CommandLine2
20
- .incCurrentY %_FontHeight%
20
+ .incCurrentY %halfLineGap%
21
21
  .SetVar CommandLine1 Variables (and commands) are not case sensitive and the above command could also be given as:
22
- .Do CommandLine1
23
- .incCurrentY %_FontHeight%
22
+ .Do CommandLine
23
+ .incCurrentY %halfLineGap%
24
24
  .SetVar CommandLine1 .drawTEXT %%%%_currentX%%%% %%%%_CURRENTy%%%% Hello World!
25
25
  .Do CommandLine2
26
- .incCurrentY %_FontHeight%
26
+ .incCurrentY %halfLineGap%
27
27
 
28
28
  .SetVar CommandLine1 Variables are stored as strings though there is a limited capability to perform arithmetic on
29
29
  .SetVar CommandLine1 %CommandLine1% variables. For example, the .IncVar command can be used to add or subtract a number from
30
30
  .SetVar CommandLine1 %CommandLine1% a variable.
31
- .Do CommandLine1
32
- .incCurrentY %_FontHeight%
31
+ .Do CommandLine
32
+ .incCurrentY %halfLineGap%
33
33
 
34
- .DrawText 0 %_CurrentY% Variables do not have to be assigned a value before being used.
34
+ .DrawText 0 %_CurrentY% Variables do not have to be assigned a value before being used.
35
+ .incCurrentY %halfLineGap%
35
36
  .DrawText 0 %_CurrentY% The value of a variable referenced before being assigned a value is an empty string.
36
- .incCurrentY %_FontHeight%
37
+ .incCurrentY %halfLineGap%
37
38
  .SetVar CommandLine1 All variables are global, there is no scoping of variables within a group. A variable
38
39
  .SetVar CommandLine1 %CommandLine1% defined within a group is available to commands run after that group.
39
- .Do CommandLine1
40
+ .Do CommandLine
@@ -31,6 +31,26 @@
31
31
  .SetVar CommandLine2 The last page orientation specified: 'portrait' or 'landscape'
32
32
  .Do VariableLineWide
33
33
 
34
+ .incCurrentY %halfLineGap%
35
+ .SetVar CommandLine1 _DateDdMmYyyy
36
+ .SetVar CommandLine2 The current date, formatted as DD/MM/YYYY.
37
+ .Do VariableLineWrapped
38
+
39
+ .incCurrentY %halfLineGap%
40
+ .SetVar CommandLine1 _DateMmDdYyyy
41
+ .SetVar CommandLine2 The current date, formatted as MM/DD/YYYY.
42
+ .Do VariableLineWrapped
43
+
44
+ .incCurrentY %halfLineGap%
45
+ .SetVar CommandLine1 _DateISO
46
+ .SetVar CommandLine2 The current date, formatted as YYYY-MM-DD.
47
+ .Do VariableLineWrapped
48
+
49
+ .incCurrentY %halfLineGap%
50
+ .SetVar CommandLine1 _FillColour
51
+ .SetVar CommandLine2 The colour that will be used when rendering any following filled boxes.
52
+ .Do VariableLineWide
53
+
34
54
  .incCurrentY %halfLineGap%
35
55
  .SetVar CommandLine1 _FontHeight
36
56
  .SetVar CommandLine2 The height of the current font. This can be used to create a space between
@@ -115,6 +135,16 @@
115
135
  .SetVar CommandLine2 %CommandLine2% will contain the number of the added page.
116
136
  .Do VariableLineWrapped
117
137
 
138
+ .incCurrentY %halfLineGap%
139
+ .SetVar CommandLine1 _LineColour
140
+ .SetVar CommandLine2 The colour that will be used to render any following lines.
141
+ .Do VariableLineWide
142
+
143
+ .incCurrentY %halfLineGap%
144
+ .SetVar CommandLine1 _LineWidth
145
+ .SetVar CommandLine2 The width that any following lines will be drawn.
146
+ .Do VariableLine
147
+
118
148
  .incCurrentY %halfLineGap%
119
149
  .SetVar CommandLine1 _MarginBottom
120
150
  .SetVar CommandLine2 The current margin from the bottom edge of the page.
@@ -170,5 +200,15 @@
170
200
  .SetVar CommandLine2 %CommandLine2% from the height of the object plus the current vertical spacing, which can
171
201
  .SetVar CommandLine2 %CommandLine2% be set with the SetSpaceVert command.
172
202
  .Do VariableLineWrapped
203
+
204
+ .incCurrentY %halfLineGap%
205
+ .SetVar CommandLine1 _TextColour
206
+ .SetVar CommandLine2 The colour that will be used when rendering any following text.
207
+ .Do VariableLineWrapped
208
+
209
+ .incCurrentY %halfLineGap%
210
+ .SetVar CommandLine1 _TimeHhMm
211
+ .SetVar CommandLine2 The current time, formatted as HH:MM.
212
+ .Do VariableLineWrapped
173
213
  .incCurrentY %_SPACEVERT%
174
214
  .Do SetMargins
@@ -10,10 +10,10 @@
10
10
  .SetVar CommandSubHeading Parameters
11
11
  .Do CommandSubHeading
12
12
  .SetVar CommandLine1 Left
13
- .SetVar CommandLine2 The horizontal starting position of the box, measured from the left margin.
13
+ .SetVar CommandLine2 The horizontal top left corner of the box, measured from the left margin.
14
14
  .Do CommandLine2
15
15
  .SetVar CommandLine1 Top
16
- .SetVar CommandLine2 The vertical starting position of the box, measured from the top margin.
16
+ .SetVar CommandLine2 The vertical top left corner of the box, measured from the top margin.
17
17
  .Do CommandLine2
18
18
  .SetVar CommandLine1 Width
19
19
  .SetVar CommandLine2 The width of the box.
@@ -25,15 +25,12 @@
25
25
  .SetVar CommandLine2 Specifies how the box is drawn:
26
26
  .Do CommandLine2
27
27
  .incCurrentY %halfLineGap%
28
- .SetVar CommandLine3 0 - An outline of the box is drawn
28
+ .SetVar CommandLine3 0 - An outline of the box is drawn using the current line width
29
29
  .Do CommandLine2
30
- .SetVar CommandLine3 1 - A filled box, without an outline is drawn
30
+ .SetVar CommandLine3 1 - A box filled with the current fill colour, without an outline is drawn
31
31
  .Do CommandLine2
32
- .SetVar CommandLine3 2 - A filled box, with an outline is drawn
32
+ .SetVar CommandLine3 2 - A box filled with the current fill colour, with an outline is drawn using the current line width
33
33
  .Do CommandLine2
34
- .incCurrentY %halfLineGap%
35
- .SetVar CommandLine1 All measurements are in the unit of measure specified when the JsPdfDynamo object was created.
36
- .Do CommandLine
37
34
 
38
35
  .SetVar CommandSubHeading Other
39
36
  .Do CommandSubHeading
@@ -62,6 +59,6 @@
62
59
 
63
60
  .SetVar CommandSubHeading See Also
64
61
  .Do CommandSubHeading
65
- .SetVar CommandLine1 SetFillColour, SetLineColour, SetLineWidth
62
+ .SetVar CommandLine1 DrawCircle, DrawEllipse, DrawLine, SetFillColour, SetLineColour, SetLineWidth
66
63
  .Do CommandLine2
67
64
  .incCurrentY %_FontHeight%
@@ -0,0 +1,71 @@
1
+ .SetVar CommandName DrawCircle
2
+ .Do CommandHeading
3
+ .SetVar CommandLine1 Draw a circle, centered at the given point using the current fill colour,
4
+ .SetVar CommandLine1 %CommandLine1% line colour and line width.
5
+ .Do CommandLine
6
+
7
+ .SetVar CommandSubHeading Syntax
8
+ .Do CommandSubHeading
9
+ .SetVar CommandLine1 .DrawCircle Left Top Radius Option
10
+ .Do CommandLine2
11
+
12
+ .SetVar CommandSubHeading Parameters
13
+ .Do CommandSubHeading
14
+ .SetVar CommandLine1 Left
15
+ .SetVar CommandLine2 The horizontal center of the circle, measured from the left margin.
16
+ .Do CommandLine2
17
+ .SetVar CommandLine1 Top
18
+ .SetVar CommandLine2 The vertical center of the circle, measured from the top margin.
19
+ .Do CommandLine2
20
+ .SetVar CommandLine1 Radius
21
+ .SetVar CommandLine2 The radius of the circle, including the width of any outline.
22
+ .Do CommandLine2
23
+ .SetVar CommandLine1 Option
24
+ .SetVar CommandLine2 Specifies how the circle is drawn:
25
+ .Do CommandLine2
26
+ .incCurrentY %halfLineGap%
27
+ .SetVar CommandLine3 0 - An outline of the circle is drawn using the current line width
28
+ .Do CommandLine2
29
+ .SetVar CommandLine3 1 - A circle filled with the current fill colour, without an outline is drawn
30
+ .Do CommandLine2
31
+ .SetVar CommandLine3 2 - A circle filled with the current fill colour, with an outline is drawn using the current line width
32
+ .Do CommandLine2
33
+
34
+ .SetVar CommandSubHeading Other
35
+ .Do CommandSubHeading
36
+ .SetVar CommandLine1 The variable _LastResult is set to '0' if there were any issues with the parameters
37
+ .SetVar CommandLine1 %CommandLine1% provided, otherwise it is set to '1'.
38
+ .Do CommandLine
39
+ .incCurrentY %_FontHeight%
40
+ .SetVar CommandLine1 Unlike most other commands, the top and left positions specify the
41
+ .SetVar CommandLine1 %CommandLine1% center point of the circle, not the left-most and top-most points.
42
+ .Do CommandLine
43
+
44
+ .SetVar CommandSubHeading Examples
45
+ .Do CommandSubHeading
46
+ .SetVar CommandLine1 Assuming that the unit of measure is millimeters,
47
+ .SetVar CommandLine1 %CommandLine1% a circle outline is drawn that is 5 millimeters high
48
+ .SetVar CommandLine1 %CommandLine1% and is centered at the current position on the page.
49
+ .Do CommandLine
50
+ .incCurrentY %halfLineGap%
51
+ .SetVar CommandLine1 .DrawCircle %%%%_CurrentX%%%% %%%%_CurrentY%%%% 5 0
52
+ .Do CommandLine2
53
+
54
+ .incCurrentY %_FontHeight%
55
+ .SetVar CommandLine1 Assuming that the unit of measure is inches,
56
+ .SetVar CommandLine1 %CommandLine1% an outlined and filled circle is drawn at the center
57
+ .SetVar CommandLine1 %CommandLine1% of the page, touching the top margin and is ½ inch high.
58
+ .Do CommandLine
59
+ .incCurrentY %halfLineGap%
60
+ .SetVar CommandLine1 .SetVar center %%%%_PageWidth%%%%
61
+ .Do CommandLine2
62
+ .SetVar CommandLine1 .MultVar center 0.5
63
+ .Do CommandLine2
64
+ .SetVar CommandLine1 .DrawCircle 0.5 %%%%center%%%% 0.5 2
65
+ .Do CommandLine2
66
+
67
+ .SetVar CommandSubHeading See Also
68
+ .Do CommandSubHeading
69
+ .SetVar CommandLine1 DrawBox, DrawEllipse, DrawLine, SetFillColour, SetLineColour, SetLineWidth
70
+ .Do CommandLine2
71
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,75 @@
1
+ .SetVar CommandName DrawEllipse
2
+ .Do CommandHeading
3
+ .SetVar CommandLine1 Draw an ellipse, centered at the given point using the current fill colour,
4
+ .SetVar CommandLine1 %CommandLine1% line colour and line width.
5
+ .Do CommandLine
6
+
7
+ .SetVar CommandSubHeading Syntax
8
+ .Do CommandSubHeading
9
+ .SetVar CommandLine1 .DrawEllipse Left Top RadiusX RadiusY Option
10
+ .Do CommandLine2
11
+
12
+ .SetVar CommandSubHeading Parameters
13
+ .Do CommandSubHeading
14
+ .SetVar CommandLine1 Left
15
+ .SetVar CommandLine2 The horizontal center of the ellipse, measured from the left margin.
16
+ .Do CommandLine2
17
+ .SetVar CommandLine1 Top
18
+ .SetVar CommandLine2 The vertical center of the ellipse, measured from the top margin.
19
+ .Do CommandLine2
20
+ .SetVar CommandLine1 RadiusX
21
+ .SetVar CommandLine2 The horizontal radius of the ellipse, including the width of any outline.
22
+ .Do CommandLine2
23
+ .Do CommandLine2
24
+ .SetVar CommandLine1 RadiusY
25
+ .SetVar CommandLine2 The vertical radius of the ellipse, including the width of any outline.
26
+ .Do CommandLine2
27
+ .SetVar CommandLine1 Option
28
+ .SetVar CommandLine2 Specifies how the ellipse is drawn:
29
+ .Do CommandLine2
30
+ .incCurrentY %halfLineGap%
31
+ .SetVar CommandLine3 0 - An outline of the ellipse is drawn using the current line width
32
+ .Do CommandLine2
33
+ .SetVar CommandLine3 1 - An ellipse filled with the current fill colour, without an outline is drawn
34
+ .Do CommandLine2
35
+ .SetVar CommandLine3 2 - An ellipse filled with the current fill colour, with an outline is drawn using the current line width
36
+ .Do CommandLine2
37
+
38
+ .SetVar CommandSubHeading Other
39
+ .Do CommandSubHeading
40
+ .SetVar CommandLine1 The variable _LastResult is set to '0' if there were any issues with the parameters
41
+ .SetVar CommandLine1 %CommandLine1% provided, otherwise it is set to '1'.
42
+ .Do CommandLine
43
+ .incCurrentY %_FontHeight%
44
+ .SetVar CommandLine1 Unlike most other commands, the top and left positions specify the
45
+ .SetVar CommandLine1 %CommandLine1% center point of the ellipse, not the left-most and top-most points.
46
+ .Do CommandLine
47
+
48
+ .SetVar CommandSubHeading Examples
49
+ .Do CommandSubHeading
50
+ .SetVar CommandLine1 Assuming that the unit of measure is millimeters,
51
+ .SetVar CommandLine1 %CommandLine1% an outline of an ellipse is drawn that is 4.5 millimeters high,
52
+ .SetVar CommandLine1 %CommandLine1% 8.5 millimeters wide, and is centered at the current position on the page.
53
+ .Do CommandLine
54
+ .incCurrentY %halfLineGap%
55
+ .SetVar CommandLine1 .DrawEllipse %%%%_CurrentX%%%% %%%%_CurrentY%%%% 8.5 4.5 0
56
+ .Do CommandLine2
57
+
58
+ .incCurrentY %_FontHeight%
59
+ .SetVar CommandLine1 Assuming that the unit of measure is inches, an outlined and filled
60
+ .SetVar CommandLine1 %CommandLine1% ellipse is drawn at the center of the page, touching the
61
+ .SetVar CommandLine1 %CommandLine1% top margin and is ½ inch high and 1 inch wide.
62
+ .Do CommandLine
63
+ .incCurrentY %halfLineGap%
64
+ .SetVar CommandLine1 .SetVar center %%%%_PageWidth%%%%
65
+ .Do CommandLine2
66
+ .SetVar CommandLine1 .MultVar center 0.5
67
+ .Do CommandLine2
68
+ .SetVar CommandLine1 .DrawEllipse 0.5 %%%%center%%%% 1 0.5 2
69
+ .Do CommandLine2
70
+
71
+ .SetVar CommandSubHeading See Also
72
+ .Do CommandSubHeading
73
+ .SetVar CommandLine1 DrawBox, DrawCircle, DrawLine, SetFillColour, SetLineColour, SetLineWidth
74
+ .Do CommandLine2
75
+ .incCurrentY %_FontHeight%