jspdf-dynamo 1.0.6 → 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.
package/dist/index.cjs CHANGED
@@ -842,6 +842,16 @@ var JsPdfProcessor = class {
842
842
  if (!this.checkPosition(left, top)) {
843
843
  return;
844
844
  }
845
+ if (isNaN(width)) {
846
+ this.lastError = `The width of the box is not a number`;
847
+ this.lastResult = "0";
848
+ return;
849
+ }
850
+ if (isNaN(height)) {
851
+ this.lastError = `The height of the box is not a number`;
852
+ this.lastResult = "0";
853
+ return;
854
+ }
845
855
  this.posnX = left;
846
856
  this.posnY = top;
847
857
  let lineWidthAdjustment = this._lineWidth;
@@ -862,6 +872,10 @@ var JsPdfProcessor = class {
862
872
  style = "FD";
863
873
  this._pdfDocument.setFillColor(this.fillColour);
864
874
  break;
875
+ default:
876
+ this.lastError = `The box style option '${boxType}' is not valid. It must be '0', '1' or '2'`;
877
+ this.lastResult = "0";
878
+ return;
865
879
  }
866
880
  this._pdfDocument.rect(x, y, w, h, style);
867
881
  this.posnX = this.posnX + width + this.spaceHoz;
@@ -870,6 +884,51 @@ var JsPdfProcessor = class {
870
884
  this.lastObjectWidth = width;
871
885
  this.lastResult = "1";
872
886
  }
887
+ drawCircle(input) {
888
+ const subs = this.logAndParseCommand(".drawCircle", input);
889
+ const { first: left, rest: rest1 } = getNextNumber(subs);
890
+ const { first: top, rest: rest2 } = getNextNumber(rest1);
891
+ const { first: radius, rest: rest3 } = getNextNumber(rest2);
892
+ const { first: option } = getNextNumber(rest3);
893
+ if (!this.checkPosition(left, top)) {
894
+ return;
895
+ }
896
+ if (isNaN(radius)) {
897
+ this.lastError = `The radius of the circle is not a number`;
898
+ this.lastResult = "0";
899
+ return;
900
+ }
901
+ this.posnX = left;
902
+ this.posnY = top;
903
+ const x = this.posnX + this._marginLeft;
904
+ const y = this.posnY + this._marginTop;
905
+ let r = radius;
906
+ let style = "S";
907
+ switch (option) {
908
+ case 0:
909
+ r -= this._lineWidth * 0.5;
910
+ break;
911
+ case 1:
912
+ style = "F";
913
+ this._pdfDocument.setFillColor(this.fillColour);
914
+ break;
915
+ case 2:
916
+ style = "FD";
917
+ this._pdfDocument.setFillColor(this.fillColour);
918
+ r -= this._lineWidth * 0.5;
919
+ break;
920
+ default:
921
+ this.lastError = `The circle style option '${option}' is not valid. It must be '0', '1' or '2'`;
922
+ this.lastResult = "0";
923
+ return;
924
+ }
925
+ this._pdfDocument.circle(x, y, r, style);
926
+ this.lastObjectHeight = radius * 2;
927
+ this.lastObjectWidth = this.lastObjectHeight;
928
+ this.posnX = this.posnX + radius + this.spaceHoz;
929
+ this.posnY = this.posnY + radius + this.spaceVert;
930
+ this.lastResult = "1";
931
+ }
873
932
  drawDebugGrid(input) {
874
933
  const subs = this.logAndParseCommand(".drawDebugGrid", input);
875
934
  const savedLineColour = this.lineColour;
@@ -935,6 +994,60 @@ var JsPdfProcessor = class {
935
994
  this.posnX = savedX;
936
995
  this.posnY = savedY;
937
996
  }
997
+ drawEllipse(input) {
998
+ const subs = this.logAndParseCommand(".drawEllipse", input);
999
+ const { first: left, rest: rest1 } = getNextNumber(subs);
1000
+ const { first: top, rest: rest2 } = getNextNumber(rest1);
1001
+ const { first: radiusX, rest: rest3 } = getNextNumber(rest2);
1002
+ const { first: radiusY, rest: rest4 } = getNextNumber(rest3);
1003
+ const { first: option } = getNextNumber(rest4);
1004
+ if (!this.checkPosition(left, top)) {
1005
+ return;
1006
+ }
1007
+ if (isNaN(radiusX)) {
1008
+ this.lastError = `The horizontal radius of the ellipse is not a number`;
1009
+ this.lastResult = "0";
1010
+ return;
1011
+ }
1012
+ if (isNaN(radiusY)) {
1013
+ this.lastError = `The vertical radius of the ellipse is not a number`;
1014
+ this.lastResult = "0";
1015
+ return;
1016
+ }
1017
+ this.posnX = left;
1018
+ this.posnY = top;
1019
+ const x = this.posnX + this._marginLeft;
1020
+ const y = this.posnY + this._marginTop;
1021
+ let rx = radiusX;
1022
+ let ry = radiusY;
1023
+ let style = "S";
1024
+ switch (option) {
1025
+ case 0:
1026
+ rx -= this._lineWidth * 0.5;
1027
+ ry -= this._lineWidth * 0.5;
1028
+ break;
1029
+ case 1:
1030
+ style = "F";
1031
+ this._pdfDocument.setFillColor(this.fillColour);
1032
+ break;
1033
+ case 2:
1034
+ style = "FD";
1035
+ this._pdfDocument.setFillColor(this.fillColour);
1036
+ rx -= this._lineWidth * 0.5;
1037
+ ry -= this._lineWidth * 0.5;
1038
+ break;
1039
+ default:
1040
+ this.lastError = `The circle style option '${option}' is not valid. It must be '0', '1' or '2'`;
1041
+ this.lastResult = "0";
1042
+ return;
1043
+ }
1044
+ this._pdfDocument.ellipse(x, y, rx, ry, style);
1045
+ this.lastObjectHeight = radiusY * 2;
1046
+ this.lastObjectWidth = radiusX * 2;
1047
+ this.posnX = this.posnX + radiusX + this.spaceHoz;
1048
+ this.posnY = this.posnY + radiusY + this.spaceVert;
1049
+ this.lastResult = "1";
1050
+ }
938
1051
  drawLine(input) {
939
1052
  const subs = this.logAndParseCommand(".drawLine", input);
940
1053
  const { first: left, rest: rest1 } = getNextNumber(subs);
@@ -2052,9 +2165,15 @@ var JsPdfDynamo = class {
2052
2165
  case "DrawBox".toLowerCase():
2053
2166
  processor.drawBox(parameters);
2054
2167
  return;
2168
+ case "DrawCircle".toLowerCase():
2169
+ processor.drawCircle(parameters);
2170
+ return;
2055
2171
  case "DrawDebugGrid".toLowerCase():
2056
2172
  processor.drawDebugGrid(parameters);
2057
2173
  return;
2174
+ case "DrawEllipse".toLowerCase():
2175
+ processor.drawEllipse(parameters);
2176
+ return;
2058
2177
  case "DrawImage".toLowerCase():
2059
2178
  processor.drawImage(parameters);
2060
2179
  return;
package/dist/index.d.cts CHANGED
@@ -315,7 +315,9 @@ declare class JsPdfProcessor {
315
315
  private getContentType;
316
316
  checkPage(jsPdfDynamo: JsPdfDynamo, input: string): Promise<void>;
317
317
  drawBox(input: string): void;
318
+ drawCircle(input: string): void;
318
319
  drawDebugGrid(input: string): void;
320
+ drawEllipse(input: string): void;
319
321
  drawLine(input: string): void;
320
322
  drawImage(input: string): void;
321
323
  drawText(input: string): void;
package/dist/index.d.ts CHANGED
@@ -315,7 +315,9 @@ declare class JsPdfProcessor {
315
315
  private getContentType;
316
316
  checkPage(jsPdfDynamo: JsPdfDynamo, input: string): Promise<void>;
317
317
  drawBox(input: string): void;
318
+ drawCircle(input: string): void;
318
319
  drawDebugGrid(input: string): void;
320
+ drawEllipse(input: string): void;
319
321
  drawLine(input: string): void;
320
322
  drawImage(input: string): void;
321
323
  drawText(input: string): void;
package/dist/index.js CHANGED
@@ -813,6 +813,16 @@ var JsPdfProcessor = class {
813
813
  if (!this.checkPosition(left, top)) {
814
814
  return;
815
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
+ }
816
826
  this.posnX = left;
817
827
  this.posnY = top;
818
828
  let lineWidthAdjustment = this._lineWidth;
@@ -833,6 +843,10 @@ var JsPdfProcessor = class {
833
843
  style = "FD";
834
844
  this._pdfDocument.setFillColor(this.fillColour);
835
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;
836
850
  }
837
851
  this._pdfDocument.rect(x, y, w, h, style);
838
852
  this.posnX = this.posnX + width + this.spaceHoz;
@@ -841,6 +855,51 @@ var JsPdfProcessor = class {
841
855
  this.lastObjectWidth = width;
842
856
  this.lastResult = "1";
843
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
+ }
844
903
  drawDebugGrid(input) {
845
904
  const subs = this.logAndParseCommand(".drawDebugGrid", input);
846
905
  const savedLineColour = this.lineColour;
@@ -906,6 +965,60 @@ var JsPdfProcessor = class {
906
965
  this.posnX = savedX;
907
966
  this.posnY = savedY;
908
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";
1021
+ }
909
1022
  drawLine(input) {
910
1023
  const subs = this.logAndParseCommand(".drawLine", input);
911
1024
  const { first: left, rest: rest1 } = getNextNumber(subs);
@@ -2023,9 +2136,15 @@ var JsPdfDynamo = class {
2023
2136
  case "DrawBox".toLowerCase():
2024
2137
  processor.drawBox(parameters);
2025
2138
  return;
2139
+ case "DrawCircle".toLowerCase():
2140
+ processor.drawCircle(parameters);
2141
+ return;
2026
2142
  case "DrawDebugGrid".toLowerCase():
2027
2143
  processor.drawDebugGrid(parameters);
2028
2144
  return;
2145
+ case "DrawEllipse".toLowerCase():
2146
+ processor.drawEllipse(parameters);
2147
+ return;
2029
2148
  case "DrawImage".toLowerCase():
2030
2149
  processor.drawImage(parameters);
2031
2150
  return;
@@ -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%
@@ -14,10 +14,8 @@
14
14
  .Do CommandSubHeading
15
15
  .SetVar CommandLine1 VariableName
16
16
  .SetVar CommandLine2 The name of the variable to check. This does not need to be surrounded
17
- .Do CommandLine2
18
- .SetVar CommandLine2 by percentage signs unless the name of the actual variable to check is
19
- .Do CommandLine2
20
- .SetVar CommandLine2 given in the variable name parameter.
17
+ .SetVar CommandLine2 %CommandLine2% by percentage signs unless the name of the actual variable to
18
+ .SetVar CommandLine2 %CommandLine2% check is given in the variable name parameter.
21
19
  .Do CommandLine2
22
20
  .SetVar CommandLine1 Command
23
21
  .SetVar CommandLine2 The command to execute if the given variable is blank.
@@ -26,8 +24,7 @@
26
24
  .SetVar CommandSubHeading Other
27
25
  .Do CommandSubHeading
28
26
  .SetVar CommandLine1 The variable _LastResult is set to '-1' if the variable is not blank, otherwise the result of the
29
- .Do CommandLine
30
- .SetVar CommandLine1 last command processed by this command.
27
+ .SetVar CommandLine1 %CommandLine1% last command processed by this command.
31
28
  .Do CommandLine
32
29
 
33
30
  .SetVar CommandSubHeading Examples
@@ -35,22 +32,20 @@
35
32
  .SetVar CommandLine1 Print a warning message if a variable called 'MyHeading' is blank (or not defined):
36
33
  .Do CommandLine
37
34
  .incCurrentY %halfLineGap%
38
- .SetVar CommandLine1 .IfBlank MyHeading .DrawText 0 %%%%_CurrentY%%%% *** No heading provided **
35
+ .SetVar CommandLine1 .IfBlank MyHeading .DrawText 0 %%%%_CurrentY%%%% *** No heading provided **
39
36
  .Do CommandLine2
40
37
  .incCurrentY %_FontHeight%
41
38
 
42
- .SetVar CommandLine1 Process the groups 'CloseSection' and 'NewSection' if the variable called 'more' is blank
43
- .Do CommandLine
44
- .SetVar CommandLine1 (or not defined):
39
+ .SetVar CommandLine1 Process the groups 'CloseSection' and 'NewSection' if the variable called 'more'
40
+ .SetVar CommandLine1 %CommandLine1% is blank (or not defined):
45
41
  .Do CommandLine
46
42
  .incCurrentY %halfLineGap%
47
43
  .SetVar CommandLine1 .IfBlank MORE .Do CloseSection NewSection
48
44
  .Do CommandLine2
49
45
  .incCurrentY %_FontHeight%
50
46
 
51
- .SetVar CommandLine1 Process the groups 'CloseSection' and 'NewSection' if the variable whose name is stored
52
- .Do CommandLine
53
- .SetVar CommandLine1 in the variable named 'varname' is blank (or not defined):
47
+ .SetVar CommandLine1 Process the groups 'CloseSection' and 'NewSection' if the variable whose name
48
+ .SetVar CommandLine1 %CommandLine1% is stored in the variable named 'varname' is blank (or not defined):
54
49
  .Do CommandLine
55
50
  .incCurrentY %halfLineGap%
56
51
  .SetVar CommandLine1 .IfBlank %%%%VarName%%%% .Do CloseSection NewSection
@@ -58,6 +53,6 @@
58
53
 
59
54
  .SetVar CommandSubHeading See Also
60
55
  .Do CommandSubHeading
61
- .SetVar CommandLine1 IfEq, IfGt, IfNotBlank
56
+ .SetVar CommandLine1 IfEq, IfGt, IfNe, IfNotBlank
62
57
  .Do CommandLine2
63
58
  .incCurrentY %_FontHeight%
@@ -19,13 +19,14 @@
19
19
  .SetVar CommandLine2 variables using substitution.
20
20
  .Do CommandLine2
21
21
  .SetVar CommandLine1 Command
22
- .SetVar CommandLine2 The command to execute if the first value is greater than the second.
22
+ .SetVar CommandLine2 The command to execute if the first value is equal to the second.
23
23
  .Do CommandLine2
24
24
 
25
25
  .SetVar CommandSubHeading Other
26
26
  .Do CommandSubHeading
27
27
  .SetVar text The variable _LastResult is set to '0' if the first variable is not equal to the second, otherwise
28
28
  .SetVar text %text% _LastResult is set to the result of the last command processed by this command.
29
+ .SetVar text %text% (Which could also be zero, depending on the result of the last command processed.)
29
30
  .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
30
31
  .incCurrentY %HalfFontHeight%
31
32
  .SetVar text Comparison of string values is case sensitive.
@@ -48,6 +49,6 @@
48
49
 
49
50
  .SetVar CommandSubHeading See Also
50
51
  .Do CommandSubHeading
51
- .SetVar CommandLine1 IfBlank, IfGt, IfNotBlank
52
+ .SetVar CommandLine1 IfBlank, IfGt, IfNe, IfNotBlank
52
53
  .Do CommandLine2
53
54
  .incCurrentY %_FontHeight%
@@ -26,6 +26,7 @@
26
26
  .Do CommandSubHeading
27
27
  .SetVar text The variable _LastResult is set to '0' if the first variable is less than or equal to the second, otherwise
28
28
  .SetVar text %text% _LastResult is set to the result of the last command processed by this command.
29
+ .SetVar text %text% (Which could also be zero, depending on the result of the last command processed.)
29
30
  .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
30
31
  .incCurrentY %halfLineGap%
31
32
  .SetVar text No action is taken if the two variables have the same value or if the second value is greater than the first.
@@ -53,6 +54,6 @@
53
54
 
54
55
  .SetVar CommandSubHeading See Also
55
56
  .Do CommandSubHeading
56
- .SetVar CommandLine1 IfBlank, IfEq, IfNotBlank
57
+ .SetVar CommandLine1 IfBlank, IfEq, IfNe, IfNotBlank
57
58
  .Do CommandLine2
58
59
  .incCurrentY %_FontHeight%
@@ -0,0 +1,54 @@
1
+ .SetVar CommandName IfNe
2
+ .Do CommandHeading
3
+ .SetVar text Compares two variables and if the first one is not equal to the second then process a given command. This can be used
4
+ .SetVar text %text% to process one or more groups of commands using the 'do' command or perform some other action, such
5
+ .SetVar text %text% as setting the value of a variable. If either of the variables are not numbers then a string comparison is made.
6
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
7
+
8
+ .SetVar CommandSubHeading Syntax
9
+ .Do CommandSubHeading
10
+ .SetVar CommandLine1 .IfNe Value1 Value2 Command
11
+ .Do CommandLine2
12
+
13
+ .SetVar CommandSubHeading Parameters
14
+ .Do CommandSubHeading
15
+ .SetVar CommandLine1 Value1,
16
+ .SetVar CommandLine2 The values to compare. These can either be constants or values of
17
+ .Do CommandLine2
18
+ .SetVar CommandLine1 Value2
19
+ .SetVar CommandLine2 variables using substitution.
20
+ .Do CommandLine2
21
+ .SetVar CommandLine1 Command
22
+ .SetVar CommandLine2 The command to execute if the first value is not equal to the second.
23
+ .Do CommandLine2
24
+
25
+ .SetVar CommandSubHeading Other
26
+ .Do CommandSubHeading
27
+ .SetVar text The variable _LastResult is set to '0' if the first variable is equal to the second, otherwise
28
+ .SetVar text %text% _LastResult is set to the result of the last command processed by this command.
29
+ .SetVar text %text% (Which could also be zero, depending on the result of the last command processed.)
30
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
31
+ .incCurrentY %HalfFontHeight%
32
+ .SetVar text Comparison of string values is case sensitive.
33
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
34
+
35
+ .SetVar CommandSubHeading Examples
36
+ .Do CommandSubHeading
37
+ .SetVar text Set the value of variable 'finished' to 'false' when the values of variables 'counter' and 'maxCounter' are not equal.
38
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
39
+ .Do CommandLine2
40
+ .SetVar CommandLine1 .IfNE %%%%counter%%%% %%%%maxCounter%%%% .SetVar finished false
41
+ .Do CommandLine2
42
+
43
+ .incCurrentY %_FontHeight%
44
+ .SetVar LongText Process the groups 'OutputLine' and 'AddToTotal' if the value of the variable 'finished' is not 'true'.
45
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %LongText%
46
+ .incCurrentY %halfLineGap%
47
+ .SetVar CommandLine1 .IfNe %%%%finished%%%% true .Do OutputLine AddToTotal
48
+ .Do CommandLine2
49
+
50
+ .SetVar CommandSubHeading See Also
51
+ .Do CommandSubHeading
52
+ .SetVar CommandLine1 IfBlank, IfEq, IfGt, IfNotBlank
53
+ .Do CommandLine2
54
+ .incCurrentY %_FontHeight%
@@ -1,7 +1,7 @@
1
1
  .SetVar CommandName IfNotBlank
2
2
  .Do CommandHeading
3
- .DrawText 0 %_CurrentY% Tests a given variable and if it is not blank then process a given command. This can be
4
- .SetVar CommandLine1 used to process one or more groups of commands using the 'do' command.
3
+ .SetVar CommandLine1 Tests a given variable and if it is not blank then process a given command. This can be
4
+ .SetVar CommandLine1 %CommandLine1% used to process one or more groups of commands using the 'do' command.
5
5
  .Do CommandLine
6
6
 
7
7
  .SetVar CommandSubHeading Syntax
@@ -12,11 +12,9 @@
12
12
  .SetVar CommandSubHeading Parameters
13
13
  .Do CommandSubHeading
14
14
  .SetVar CommandLine1 VariableName
15
- .SetVar CommandLine2 The name of the variable to check. This does not need to be surrounded
16
- .Do CommandLine2
17
- .SetVar CommandLine2 by percentage signs unless the name of the actual variable to check is
18
- .Do CommandLine2
19
- .SetVar CommandLine2 given in the variable name parameter.
15
+ .SetVar CommandLine2 The name of the variable to check. This does not need to be surrounded by
16
+ .SetVar CommandLine2 %CommandLine2% percentage signs unless the name of the actual variable to
17
+ .SetVar CommandLine2 %CommandLine2% check is given in the variable name parameter.
20
18
  .Do CommandLine2
21
19
  .SetVar CommandLine1 Command
22
20
  .SetVar CommandLine2 The command to execute if the given variable is not blank.
@@ -25,8 +23,7 @@
25
23
  .SetVar CommandSubHeading Other
26
24
  .Do CommandSubHeading
27
25
  .SetVar CommandLine1 The variable _LastResult is set to '-1' if the variable is blank, otherwise the result of the
28
- .Do CommandLine
29
- .SetVar CommandLine1 last command processed by this command.
26
+ .SetVar CommandLine1 %CommandLine1% last command processed by this command.
30
27
  .Do CommandLine
31
28
 
32
29
  .SetVar CommandSubHeading Examples
@@ -45,9 +42,8 @@
45
42
  .Do CommandLine2
46
43
  .incCurrentY %_FontHeight%
47
44
 
48
- .SetVar CommandLine1 Process the groups 'continued' and 'AddPage' if the variable whose name is stored in the
49
- .Do CommandLine
50
- .SetVar CommandLine1 variable named 'varname' is not blank:
45
+ .SetVar CommandLine1 Process the groups 'continued' and 'AddPage' if the variable whose name is stored
46
+ .SetVar CommandLine1 %CommandLine1% in the variable named 'varname' is not blank:
51
47
  .Do CommandLine
52
48
  .incCurrentY %halfLineGap%
53
49
  .SetVar CommandLine1 .IfNotBlank %%%%VarName%%%% .Do continued AddPage
@@ -55,6 +51,6 @@
55
51
 
56
52
  .SetVar CommandSubHeading See Also
57
53
  .Do CommandSubHeading
58
- .SetVar CommandLine1 IfEq, IfGt, IfBlank
54
+ .SetVar CommandLine1 IfBlank, IfEq, IfGt, IfNe
59
55
  .Do CommandLine2
60
56
  .incCurrentY %_FontHeight%
Binary file
@@ -225,7 +225,9 @@
225
225
  .Include ./Documentation/4. Commands/Do.txt
226
226
  .Include ./Documentation/4. Commands/DoRepeat.txt
227
227
  .Include ./Documentation/4. Commands/DrawBox.txt
228
+ .Include ./Documentation/4. Commands/DrawCircle.txt
228
229
  .Include ./Documentation/4. Commands/DrawDebugGrid.txt
230
+ .Include ./Documentation/4. Commands/DrawEllipse.txt
229
231
  .Include ./Documentation/4. Commands/DrawImage.txt
230
232
  .Include ./Documentation/4. Commands/DrawLine.txt
231
233
  .Include ./Documentation/4. Commands/DrawText.txt
@@ -235,6 +237,7 @@
235
237
  .Include ./Documentation/4. Commands/IfBlank.txt
236
238
  .Include ./Documentation/4. Commands/IfEq.txt
237
239
  .Include ./Documentation/4. Commands/IfGt.txt
240
+ .Include ./Documentation/4. Commands/IfNe.txt
238
241
  .Include ./Documentation/4. Commands/IfNotBlank.txt
239
242
  .Include ./Documentation/4. Commands/incCurrentX.txt
240
243
  .Include ./Documentation/4. Commands/incCurrentY.txt
@@ -46,7 +46,7 @@ endobj
46
46
  6 0 obj
47
47
  <<
48
48
  /Producer (jsPDF 2.5.2)
49
- /CreationDate (D:20241002155924+10'00')
49
+ /CreationDate (D:20241006151126+10'00')
50
50
  >>
51
51
  endobj
52
52
  7 0 obj
@@ -72,7 +72,7 @@ trailer
72
72
  /Size 8
73
73
  /Root 7 0 R
74
74
  /Info 6 0 R
75
- /ID [ <057B68611040878E4A1ECADDBA2E3039> <057B68611040878E4A1ECADDBA2E3039> ]
75
+ /ID [ <A4FE96B1D9C5D34C705DDBFDD4170A74> <A4FE96B1D9C5D34C705DDBFDD4170A74> ]
76
76
  >>
77
77
  startxref
78
78
  892
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jspdf-dynamo",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Generate data driven PDFs from dynamic templates",
5
5
  "main": "dist/index.js",
6
6
  "repository": {