jspdf-dynamo 1.0.6 → 1.0.8
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 +124 -3
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +121 -0
- package/documentation/3. Variables/SystemMaintained.txt +6 -0
- package/documentation/4. Commands/DrawBox.txt +6 -9
- package/documentation/4. Commands/DrawCircle.txt +71 -0
- package/documentation/4. Commands/DrawEllipse.txt +75 -0
- package/documentation/4. Commands/IfBlank.txt +9 -14
- package/documentation/4. Commands/IfEq.txt +3 -2
- package/documentation/4. Commands/IfGt.txt +2 -1
- package/documentation/4. Commands/IfNe.txt +54 -0
- package/documentation/4. Commands/IfNotBlank.txt +9 -13
- package/documentation/4. Commands/SavePdf.txt +35 -2
- package/documentation/4. Commands/SelectPage.txt +27 -2
- package/documentation/4. Commands/SetFillColour.txt +1 -0
- package/documentation/4. Commands/SetFontName.txt +2 -0
- package/documentation/4. Commands/SetFontSize.txt +1 -0
- package/documentation/4. Commands/SetLineColour.txt +1 -0
- package/documentation/Documentation.pdf +0 -0
- package/documentation/documentation.txt +3 -6
- package/examples/1.Simple/simple.pdf +2 -2
- package/examples/{examples.spec.ts → 1.Simple/simple.spec.ts} +3 -3
- package/examples/2.Invoice/invoice.pdf +0 -0
- package/package.json +7 -5
package/dist/index.cjs
CHANGED
|
@@ -55,11 +55,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
// src/index.ts
|
|
58
|
-
var
|
|
59
|
-
__export(
|
|
58
|
+
var index_exports = {};
|
|
59
|
+
__export(index_exports, {
|
|
60
60
|
JsPdfDynamo: () => JsPdfDynamo
|
|
61
61
|
});
|
|
62
|
-
module.exports = __toCommonJS(
|
|
62
|
+
module.exports = __toCommonJS(index_exports);
|
|
63
63
|
|
|
64
64
|
// src/models/jsPdfProcessor.ts
|
|
65
65
|
var import_jspdf = __toESM(require("jspdf"), 1);
|
|
@@ -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);
|
|
@@ -1517,6 +1630,7 @@ var JsPdfProcessor = class {
|
|
|
1517
1630
|
let subs = this.logAndParseCommand(".savePdf", input.trim());
|
|
1518
1631
|
if (isBrowser()) {
|
|
1519
1632
|
this.lastError = "SavePdf is not supported in the browser";
|
|
1633
|
+
this._logger.warn(this.lastError);
|
|
1520
1634
|
this.lastResult = "0";
|
|
1521
1635
|
return;
|
|
1522
1636
|
}
|
|
@@ -1552,6 +1666,7 @@ var JsPdfProcessor = class {
|
|
|
1552
1666
|
this.lastResult = pageNo.toString();
|
|
1553
1667
|
this.posnX = 0;
|
|
1554
1668
|
this.posnY = 0;
|
|
1669
|
+
this.lastResult = "1";
|
|
1555
1670
|
}
|
|
1556
1671
|
setCurrentFont(fontName, fontStyle) {
|
|
1557
1672
|
this._pdfDocument.setFont(fontName, fontStyle);
|
|
@@ -2052,9 +2167,15 @@ var JsPdfDynamo = class {
|
|
|
2052
2167
|
case "DrawBox".toLowerCase():
|
|
2053
2168
|
processor.drawBox(parameters);
|
|
2054
2169
|
return;
|
|
2170
|
+
case "DrawCircle".toLowerCase():
|
|
2171
|
+
processor.drawCircle(parameters);
|
|
2172
|
+
return;
|
|
2055
2173
|
case "DrawDebugGrid".toLowerCase():
|
|
2056
2174
|
processor.drawDebugGrid(parameters);
|
|
2057
2175
|
return;
|
|
2176
|
+
case "DrawEllipse".toLowerCase():
|
|
2177
|
+
processor.drawEllipse(parameters);
|
|
2178
|
+
return;
|
|
2058
2179
|
case "DrawImage".toLowerCase():
|
|
2059
2180
|
processor.drawImage(parameters);
|
|
2060
2181
|
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);
|
|
@@ -1488,6 +1601,7 @@ var JsPdfProcessor = class {
|
|
|
1488
1601
|
let subs = this.logAndParseCommand(".savePdf", input.trim());
|
|
1489
1602
|
if (isBrowser()) {
|
|
1490
1603
|
this.lastError = "SavePdf is not supported in the browser";
|
|
1604
|
+
this._logger.warn(this.lastError);
|
|
1491
1605
|
this.lastResult = "0";
|
|
1492
1606
|
return;
|
|
1493
1607
|
}
|
|
@@ -1523,6 +1637,7 @@ var JsPdfProcessor = class {
|
|
|
1523
1637
|
this.lastResult = pageNo.toString();
|
|
1524
1638
|
this.posnX = 0;
|
|
1525
1639
|
this.posnY = 0;
|
|
1640
|
+
this.lastResult = "1";
|
|
1526
1641
|
}
|
|
1527
1642
|
setCurrentFont(fontName, fontStyle) {
|
|
1528
1643
|
this._pdfDocument.setFont(fontName, fontStyle);
|
|
@@ -2023,9 +2138,15 @@ var JsPdfDynamo = class {
|
|
|
2023
2138
|
case "DrawBox".toLowerCase():
|
|
2024
2139
|
processor.drawBox(parameters);
|
|
2025
2140
|
return;
|
|
2141
|
+
case "DrawCircle".toLowerCase():
|
|
2142
|
+
processor.drawCircle(parameters);
|
|
2143
|
+
return;
|
|
2026
2144
|
case "DrawDebugGrid".toLowerCase():
|
|
2027
2145
|
processor.drawDebugGrid(parameters);
|
|
2028
2146
|
return;
|
|
2147
|
+
case "DrawEllipse".toLowerCase():
|
|
2148
|
+
processor.drawEllipse(parameters);
|
|
2149
|
+
return;
|
|
2029
2150
|
case "DrawImage".toLowerCase():
|
|
2030
2151
|
processor.drawImage(parameters);
|
|
2031
2152
|
return;
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
.SetVar text Note that unless otherwise stated, all distances and positions are in the unit of measure specified
|
|
10
10
|
.SetVar text %text% when creating the JsPdfDynamo object.
|
|
11
11
|
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
12
|
+
.SetVar text %text% variables can not be changed directly by using the SetVar command.
|
|
13
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
14
|
+
.incCurrentY %halfLineGap%
|
|
15
|
+
.SetVar text Note that unless otherwise stated, all distances and positions are in the unit of measure specified
|
|
16
|
+
.SetVar text %text% when creating the JsPdfDynamo object.
|
|
17
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
12
18
|
.incCurrentY %halfLineGap%
|
|
13
19
|
.SetMargin L 20
|
|
14
20
|
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
.SetVar CommandSubHeading Parameters
|
|
11
11
|
.Do CommandSubHeading
|
|
12
12
|
.SetVar CommandLine1 Left
|
|
13
|
-
.SetVar CommandLine2 The horizontal
|
|
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
|
|
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
|
|
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
|
|
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
|
-
.
|
|
18
|
-
.SetVar CommandLine2
|
|
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
|
-
.
|
|
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
|
|
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'
|
|
43
|
-
.
|
|
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
|
|
52
|
-
.
|
|
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
|
|
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
|
-
.
|
|
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
|
-
.
|
|
17
|
-
.SetVar CommandLine2
|
|
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
|
-
.
|
|
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
|
|
49
|
-
.
|
|
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,
|
|
54
|
+
.SetVar CommandLine1 IfBlank, IfEq, IfGt, IfNe
|
|
59
55
|
.Do CommandLine2
|
|
60
56
|
.incCurrentY %_FontHeight%
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
.SetVar CommandName SavePdf
|
|
2
2
|
.Do CommandHeading
|
|
3
|
-
.SetVar
|
|
4
|
-
.
|
|
3
|
+
.SetVar text Only available when running within Node.js, this command saves the current PDF to the given location.
|
|
4
|
+
.SetVar text %text% A warning will be logged if used within a browser.
|
|
5
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
6
|
+
|
|
7
|
+
.SetVar CommandSubHeading Syntax
|
|
8
|
+
.Do CommandSubHeading
|
|
9
|
+
.SetVar CommandLine1 .SavePdf File-name
|
|
10
|
+
.Do CommandLine2
|
|
11
|
+
|
|
12
|
+
.SetVar CommandSubHeading Parameters
|
|
13
|
+
.Do CommandSubHeading
|
|
14
|
+
.SetVar CommandLine1 File-name
|
|
15
|
+
.SetVar CommandLine2 The path and name of the file to save. This can include
|
|
16
|
+
.Do CommandLine2
|
|
17
|
+
.SetVar CommandLine2 variables as well as constant text.
|
|
18
|
+
.Do CommandLine2
|
|
19
|
+
|
|
20
|
+
.SetVar CommandSubHeading Other
|
|
21
|
+
.Do CommandSubHeading
|
|
22
|
+
.SetVar text The variable _LastResult is set to '1' if the current PDF is saved, otherwise it is set to '0'
|
|
23
|
+
.SetVar text %text% and _LastError is set to a description of the problem.
|
|
24
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
25
|
+
.incCurrentY %halfLineGap%
|
|
26
|
+
.SetVar text Note that the path must exist or this command will fail.
|
|
27
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
28
|
+
.incCurrentY %halfLineGap%
|
|
29
|
+
.SetVar text If not given the default name of Document.pdf will be used.
|
|
30
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
31
|
+
|
|
32
|
+
.SetVar CommandSubHeading Examples
|
|
33
|
+
.Do CommandSubHeading
|
|
34
|
+
.SetVar CommandLine1 .SavePdf ../output/invoice.pdf
|
|
35
|
+
.Do CommandLine2
|
|
36
|
+
.SetVar CommandLine1 .SavePdf %%%%savepath%%%%/%%%%customer%%%%.pdf
|
|
37
|
+
.Do CommandLine2
|
|
5
38
|
|
|
6
39
|
.incCurrentY %_FontHeight%
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
.SetVar CommandName SelectPage
|
|
2
2
|
.Do CommandHeading
|
|
3
|
-
.SetVar
|
|
4
|
-
.
|
|
3
|
+
.SetVar text This makes the given page active and sets the current left and top positions to zero.
|
|
4
|
+
.SetVar text %text% Subsequent commands will be relative to this page.
|
|
5
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
6
|
+
|
|
7
|
+
.SetVar CommandSubHeading Syntax
|
|
8
|
+
.Do CommandSubHeading
|
|
9
|
+
.SetVar CommandLine1 .SelectPage Value
|
|
10
|
+
.Do CommandLine2
|
|
11
|
+
|
|
12
|
+
.SetVar CommandSubHeading Parameters
|
|
13
|
+
.Do CommandSubHeading
|
|
14
|
+
.SetVar CommandLine1 Value
|
|
15
|
+
.SetVar CommandLine2 The number of the page to make active. This is 1 based.
|
|
16
|
+
.Do CommandLine2
|
|
17
|
+
|
|
18
|
+
.SetVar CommandSubHeading Other
|
|
19
|
+
.Do CommandSubHeading
|
|
20
|
+
.SetVar text The variable _LastResult is set to '1' if the command is successful, otherwise it is set to '0'
|
|
21
|
+
.SetVar text %text% and _LastError is set to a description of the problem.
|
|
22
|
+
.DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
|
|
23
|
+
|
|
24
|
+
.SetVar CommandSubHeading Examples
|
|
25
|
+
.Do CommandSubHeading
|
|
26
|
+
.SetVar CommandLine1 .SelectPage 7
|
|
27
|
+
.Do CommandLine2
|
|
28
|
+
.SetVar CommandLine1 .SelectPage %%%%_Pages%%%%
|
|
29
|
+
.Do CommandLine2
|
|
5
30
|
|
|
6
31
|
.incCurrentY %_FontHeight%
|
|
Binary file
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
.SetVar top %_PageHeight%
|
|
57
57
|
.MultVar top 0.3
|
|
58
58
|
.DrawTextBox 0 %top% %_PageWidth% %_FontHeight% centered top jsPdf-Dynamo
|
|
59
|
-
.DrawTextBox 0 %_CurrentY% %_PageWidth% %_FontHeight% centered top (Draft)
|
|
60
59
|
.incCurrentY 2
|
|
61
60
|
.SetFontSize 24
|
|
62
61
|
.SetTextColour %black%
|
|
@@ -81,11 +80,6 @@
|
|
|
81
80
|
[End]
|
|
82
81
|
|
|
83
82
|
[Footer]
|
|
84
|
-
.setMargin t 7
|
|
85
|
-
.setFontStyle Bold
|
|
86
|
-
.setFontSize 18
|
|
87
|
-
.SetTextColour red
|
|
88
|
-
.ifGt %_PageNo% 1 .DrawTextBox 0 0 %_PageWidth% 8 centered centered *** Draft ***
|
|
89
83
|
.Do SetDefaultText
|
|
90
84
|
.SetVar top %_PageHeight%
|
|
91
85
|
.incVar top -%_FontHeight%
|
|
@@ -225,7 +219,9 @@
|
|
|
225
219
|
.Include ./Documentation/4. Commands/Do.txt
|
|
226
220
|
.Include ./Documentation/4. Commands/DoRepeat.txt
|
|
227
221
|
.Include ./Documentation/4. Commands/DrawBox.txt
|
|
222
|
+
.Include ./Documentation/4. Commands/DrawCircle.txt
|
|
228
223
|
.Include ./Documentation/4. Commands/DrawDebugGrid.txt
|
|
224
|
+
.Include ./Documentation/4. Commands/DrawEllipse.txt
|
|
229
225
|
.Include ./Documentation/4. Commands/DrawImage.txt
|
|
230
226
|
.Include ./Documentation/4. Commands/DrawLine.txt
|
|
231
227
|
.Include ./Documentation/4. Commands/DrawText.txt
|
|
@@ -235,6 +231,7 @@
|
|
|
235
231
|
.Include ./Documentation/4. Commands/IfBlank.txt
|
|
236
232
|
.Include ./Documentation/4. Commands/IfEq.txt
|
|
237
233
|
.Include ./Documentation/4. Commands/IfGt.txt
|
|
234
|
+
.Include ./Documentation/4. Commands/IfNe.txt
|
|
238
235
|
.Include ./Documentation/4. Commands/IfNotBlank.txt
|
|
239
236
|
.Include ./Documentation/4. Commands/incCurrentX.txt
|
|
240
237
|
.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:
|
|
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 [ <
|
|
75
|
+
/ID [ <A4FE96B1D9C5D34C705DDBFDD4170A74> <A4FE96B1D9C5D34C705DDBFDD4170A74> ]
|
|
76
76
|
>>
|
|
77
77
|
startxref
|
|
78
78
|
892
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { expect, it, describe } from "vitest";
|
|
2
|
-
import { JsPdfDynamo } from "
|
|
2
|
+
import { JsPdfDynamo } from "../../src/jsPdfDynamo";
|
|
3
3
|
|
|
4
|
-
describe("
|
|
5
|
-
it("
|
|
4
|
+
describe("1. Simple example", () => {
|
|
5
|
+
it("Create", async () => {
|
|
6
6
|
const pdfDynamo = new JsPdfDynamo({
|
|
7
7
|
pageSize: "a4",
|
|
8
8
|
orientation: "portrait",
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jspdf-dynamo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Generate data driven PDFs from dynamic templates",
|
|
5
|
-
"main": "dist/index.
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
10
|
"url": "git+https://github.com/SteveCorbett/jsPdf-Dynamo"
|
|
@@ -33,7 +35,7 @@
|
|
|
33
35
|
"author": "Stephen Corbett <corbett@corbtech.com.au> (https://corbtech.com.au)",
|
|
34
36
|
"license": "MIT",
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"jspdf": "^
|
|
38
|
+
"jspdf": "^4.1.0"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@arethetypeswrong/cli": "^0.15.4",
|
|
@@ -44,7 +46,7 @@
|
|
|
44
46
|
"tslog": "^4.9.3",
|
|
45
47
|
"tsup": "^8.2.4",
|
|
46
48
|
"typescript": "^5.5.4",
|
|
47
|
-
"vitest": "^
|
|
49
|
+
"vitest": "^4.0.18"
|
|
48
50
|
},
|
|
49
51
|
"files": [
|
|
50
52
|
"dist",
|
|
@@ -58,7 +60,7 @@
|
|
|
58
60
|
"./package.json": "./package.json",
|
|
59
61
|
".": {
|
|
60
62
|
"import": "./dist/index.js",
|
|
61
|
-
"
|
|
63
|
+
"require": "./dist/index.cjs"
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
}
|