jspdf-dynamo 1.0.0

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 (66) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +93 -0
  3. package/dist/index.cjs +2175 -0
  4. package/dist/index.d.cts +370 -0
  5. package/dist/index.d.ts +370 -0
  6. package/dist/index.js +2145 -0
  7. package/documentation/1. Introduction/Introduction.txt +91 -0
  8. package/documentation/2. JsPdfDynamo/JsPdfDynamo.txt +6 -0
  9. package/documentation/2. JsPdfDynamo/constructor.txt +31 -0
  10. package/documentation/2. JsPdfDynamo/getVariable.txt +29 -0
  11. package/documentation/2. JsPdfDynamo/prepareWrappedString.txt +28 -0
  12. package/documentation/2. JsPdfDynamo/processCommands.txt +27 -0
  13. package/documentation/2. JsPdfDynamo/toBlob.txt +19 -0
  14. package/documentation/2. JsPdfDynamo/toBlobUrl.txt +36 -0
  15. package/documentation/3. Variables/Introduction.txt +36 -0
  16. package/documentation/3. Variables/SystemMaintained.txt +190 -0
  17. package/documentation/4. Commands/AddBookmark.txt +47 -0
  18. package/documentation/4. Commands/AddImageFromFile.txt +59 -0
  19. package/documentation/4. Commands/AddImageFromUrl.txt +63 -0
  20. package/documentation/4. Commands/AddPage.txt +40 -0
  21. package/documentation/4. Commands/CheckPage.txt +52 -0
  22. package/documentation/4. Commands/CopyVar.txt +52 -0
  23. package/documentation/4. Commands/Do.txt +40 -0
  24. package/documentation/4. Commands/DoRepeat.txt +51 -0
  25. package/documentation/4. Commands/DrawBox.txt +67 -0
  26. package/documentation/4. Commands/DrawDebugGrid.txt +41 -0
  27. package/documentation/4. Commands/DrawImage.txt +92 -0
  28. package/documentation/4. Commands/DrawLine.txt +62 -0
  29. package/documentation/4. Commands/DrawText.txt +61 -0
  30. package/documentation/4. Commands/DrawTextBox.txt +99 -0
  31. package/documentation/4. Commands/DrawTextWrapped.txt +65 -0
  32. package/documentation/4. Commands/ForEachPage.txt +44 -0
  33. package/documentation/4. Commands/GetEnvVar.txt +56 -0
  34. package/documentation/4. Commands/IfBlank.txt +63 -0
  35. package/documentation/4. Commands/IfGt.txt +58 -0
  36. package/documentation/4. Commands/IfNotBlank.txt +60 -0
  37. package/documentation/4. Commands/IncCurrentX.txt +52 -0
  38. package/documentation/4. Commands/IncCurrentY.txt +50 -0
  39. package/documentation/4. Commands/IncVar.txt +73 -0
  40. package/documentation/4. Commands/Include.txt +44 -0
  41. package/documentation/4. Commands/MultVar.txt +70 -0
  42. package/documentation/4. Commands/SetCurrentX.txt +37 -0
  43. package/documentation/4. Commands/SetCurrentY.txt +37 -0
  44. package/documentation/4. Commands/SetDocumentInfo.txt +35 -0
  45. package/documentation/4. Commands/SetFillColour.txt +58 -0
  46. package/documentation/4. Commands/SetFontName.txt +4 -0
  47. package/documentation/4. Commands/SetFontSize.txt +22 -0
  48. package/documentation/4. Commands/SetFontStyle.txt +55 -0
  49. package/documentation/4. Commands/SetLineColour.txt +58 -0
  50. package/documentation/4. Commands/SetLineWidth.txt +42 -0
  51. package/documentation/4. Commands/SetMargin.txt +69 -0
  52. package/documentation/4. Commands/SetPageOrientation.txt +42 -0
  53. package/documentation/4. Commands/SetVar.txt +69 -0
  54. package/documentation/5. Other Definitions/jsPdfOptions.txt +56 -0
  55. package/documentation/5. Other Definitions/logger.txt +35 -0
  56. package/documentation/5. Other Definitions/pageSizes.txt +41 -0
  57. package/documentation/6. Other/PossibleEnhancements.txt +63 -0
  58. package/documentation/6. Other/To Be Documented.txt +50 -0
  59. package/documentation/Documentation.pdf +9859 -0
  60. package/documentation/README.md +7 -0
  61. package/documentation/documentation.txt +266 -0
  62. package/documentation/gendoc.spec.ts +22 -0
  63. package/examples/1.Simple/simple.pdf +247 -0
  64. package/examples/1.Simple/template.txt +21 -0
  65. package/examples/examples.spec.ts +26 -0
  66. package/package.json +58 -0
@@ -0,0 +1,91 @@
1
+ .SetVar ChapterName Introduction
2
+ .do ChapterHeading
3
+ .SetVar text jsPdf-Dynamo is a wrapper around the open-source JavaScript PDF generation library, jsPDF.
4
+ .SetVar text %text% Using a template driven approach, it enables the separation of layout and formatting logic
5
+ .SetVar text %text% from the placement of data.
6
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% *None %text%
7
+ .incCurrentY %_FONTHEIGHT%
8
+
9
+ .SetVar text jsPdf-Dynamo can be used with browser or NodeJs JavaScript or TypeScript applications.
10
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% *None %text%
11
+ .incCurrentY %_FONTHEIGHT%
12
+
13
+ .DrawText 0 %_CurrentY% Advantages of using jsPdf-Dynamo include:
14
+ .incCurrentY %halfLineGap%
15
+
16
+ .SetVar top %_CurrentY%
17
+ .DrawText 5 %top% -
18
+ .SetVar width %_PageWidth%
19
+ .IncVar width -10
20
+ .SetVar text The separation of layout and formatting logic from the placement of data. As a page is
21
+ .SetVar text %text% filled with data, jsPdf-Dynamo can insert new pages, with appropriate headings,
22
+ .SetVar text %text% footings, and bookmarks as required.
23
+ .DrawTextWrapped 10 %top% %width% *None %text%
24
+
25
+ .SetVar top %_CurrentY%
26
+ .DrawText 5 %top% -
27
+ .SetVar text The ability to store corporate and application wide format settings in templates
28
+ .SetVar text %text% that can be maintained independently from the application.
29
+ .SetVar text %text% This is similar to the use of style sheets in web applications to enable
30
+ .SetVar text %text% visual consistency, reduce errors and minimise maintenance costs. These format settings
31
+ .SetVar text %text% can include colours, font styles and sizes, page headings, and more.
32
+ .DrawTextWrapped 10 %top% %width% *None %text%
33
+ .incCurrentY %_FONTHEIGHT%
34
+
35
+ .DrawText 0 %_CurrentY% There are a few basic concepts to be aware of when using jsPdf-Dynamo:
36
+ .incCurrentY %halfLineGap%
37
+
38
+ .SetVar top %_CurrentY%
39
+ .DrawText 5 %top% -
40
+ .SetVar text The functionality of jsPdf-Dynamo is implemented through the JsPdfDynamo class.
41
+ .DrawTextWrapped 10 %top% %width% *None %text%
42
+
43
+ .SetVar top %_CurrentY%
44
+ .DrawText 5 %top% -
45
+ .SetVar text The initial page size, orientation and units of measure are set when the
46
+ .SetVar text %text% JsPdfDynamo instance is instantiated.
47
+ .DrawTextWrapped 10 %top% %width% *None %text%
48
+
49
+ .SetVar top %_CurrentY%
50
+ .DrawText 5 %top% -
51
+ .SetVar text Output is driven by a series of plain text 'commands'. These
52
+ .SetVar text %text% commands can be provided as a list of strings from multiple sources,
53
+ .SetVar text %text% including the JavaScript or TypeScript application, or loaded from
54
+ .SetVar text %text% 'templates' retrieved from a URL (browser or NodeJs) or from local text
55
+ .SetVar text %text% files (NodeJs only).
56
+ .DrawTextWrapped 10 %top% %width% *None %text%
57
+
58
+ .SetVar top %_CurrentY%
59
+ .DrawText 5 %top% -
60
+ .SetVar text Positions are specified relative to the left and top margin. The exception to this are
61
+ .SetVar text %text% margins which are measured from the appropriate edge of the page.
62
+ .DrawTextWrapped 10 %top% %width% *None %text%
63
+
64
+ .SetVar top %_CurrentY%
65
+ .DrawText 5 %top% -
66
+ .SetVar text All measurements and positions are in the unit of measure specified
67
+ .SetVar text %text% when the instance of JsPdfDynamo is created. This can be millimeters, inches,
68
+ .SetVar text %text% or points. The exception to this are fonts, which are always specified in points.
69
+ .DrawTextWrapped 10 %top% %width% *None %text%
70
+
71
+ .SetVar top %_CurrentY%
72
+ .DrawText 5 %top% -
73
+ .DrawText 10 %top% A series of commands can be grouped and named. These groups of commands can then
74
+ .DrawText 10 %_CurrentY% be processed one or more times. This is a similar concept to methods or procedures
75
+ .DrawText 10 %_CurrentY% in more sophisticated computer languages.
76
+
77
+ .SetVar top %_CurrentY%
78
+ .DrawText 5 %top% -
79
+ .SetVar text All commands, command group names and variable names are case insensitive.
80
+ .DrawTextWrapped 10 %top% %width% *None %text%
81
+
82
+ .SetVar top %_CurrentY%
83
+ .DrawText 5 %top% -
84
+ .SetVar text There are two kinds of variables, user variables and system maintained variables.
85
+ .SetVar text %text% User variables can be created and modified as required using script commands.
86
+ .SetVar text %text% As the name implies, system maintained variables are created and maintained and
87
+ .SetVar text %text% cannot be directly modified directly by script commands.
88
+ .DrawTextWrapped 10 %top% %width% *None %text%
89
+
90
+ .incCurrentY %_FONTHEIGHT%
91
+ .DrawText 0 %_CurrentY% This document has been generated by jsPdf-Dynamo and demonstrates some of its capabilities.
@@ -0,0 +1,6 @@
1
+ .SetVar ChapterName JsPdfDynamo Class
2
+ .do ChapterHeading
3
+
4
+ .DrawText 0 %_CurrentY% JsPdfDynamo is implemented using an instance of the JsPdfDynamo class. This class has the
5
+ .DrawText 0 %_CurrentY% following public properties.
6
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,31 @@
1
+ .SetVar CommandName Constructor
2
+ .Do CommandHeading
3
+
4
+ .SetVar CommandSubHeading Syntax
5
+ .Do CommandSubHeading
6
+ .SetVar CommandLine1 const dynamo = new JsPdfDynamo(options, logger)
7
+ .Do CommandLine2
8
+
9
+ .SetVar CommandSubHeading Parameters
10
+ .Do CommandSubHeading
11
+ .SetVar CommandLine1 options
12
+ .SetVar CommandLine2 An optional object that implements some or all of the properties of a JsPdfOptions
13
+ .SetVar CommandLine2 %CommandLine2% object. (Refer to the description in the Other Definitions chapter.)
14
+ .Do CommandLine2
15
+ .SetVar CommandLine1 logger
16
+ .SetVar CommandLine2 An optional object that implements some or all of the properties of a Logger
17
+ .SetVar CommandLine2 %CommandLine2% class. (Refer to the description in the Other Definitions chapter.)
18
+ .SetVar CommandLine2 %CommandLine2% If a logger object is not provided than a default one is created
19
+ .SetVar CommandLine2 %CommandLine2% that outputs to the console.
20
+ .Do CommandLine2
21
+
22
+ .SetVar CommandSubHeading Returns
23
+ .Do CommandSubHeading
24
+ .SetVar CommandLine1 An instance of the JsPdfDynamo class.
25
+ .Do CommandLine2
26
+
27
+ .SetVar CommandSubHeading Notes
28
+ .Do CommandSubHeading
29
+ .SetVar text The first, blank page of the PDF will have been created and initialised with the given (or default) values.
30
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
31
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,29 @@
1
+ .SetVar CommandName getVariable()
2
+ .Do CommandHeading
3
+ .SetVar text This method returns the current value of a variable as a string. This can be useful for unit testing.
4
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
5
+
6
+ .SetVar CommandSubHeading Syntax
7
+ .Do CommandSubHeading
8
+ .SetVar CommandLine1 getVariable(varName)
9
+ .SetVar CommandLine2 The name of the variable to retrieve. This can be the name of either a user or a
10
+ .SetVar CommandLine2 %CommandLine2% system maintained variable.
11
+ .Do CommandLine2
12
+
13
+ .SetVar CommandSubHeading Parameters
14
+ .Do CommandSubHeading
15
+ .SetVar CommandLine1 varName
16
+ .SetVar CommandLine2 A string or constant containing the name of the variable whose value is to be retrieved.
17
+ .SetVar CommandLine2 %CommandLine2% (The name is not case sensitive.)
18
+ .Do CommandLine2
19
+
20
+ .SetVar CommandSubHeading Returns
21
+ .Do CommandSubHeading
22
+ .SetVar CommandLine1 The current value of the named variable as a string.
23
+ .Do CommandLine2
24
+
25
+ .SetVar CommandSubHeading Notes
26
+ .Do CommandSubHeading
27
+ .SetVar LongText If the supplied variable does not exist at the time this method is called then a null value is returned.
28
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %LongText%
29
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,28 @@
1
+ .SetVar CommandName prepareWrappedString()
2
+ .Do CommandHeading
3
+ .SetVar LongText This method prepares a given string for output by the DrawTextWrapped command.
4
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %LongText%
5
+
6
+ .SetVar CommandSubHeading Syntax
7
+ .Do CommandSubHeading
8
+ .SetVar CommandLine1 const text = myJsPdfDynamo.prepareWrappedString(input)
9
+ .Do CommandLine2
10
+
11
+ .SetVar CommandSubHeading Parameters
12
+ .Do CommandSubHeading
13
+ .SetVar CommandLine1 input
14
+ .SetVar CommandLine2 A string that may contain special characters, including percentage signs, back
15
+ .SetVar CommandLine2 %CommandLine2% slashes and new line characters.
16
+ .Do CommandLine2
17
+
18
+ .SetVar CommandSubHeading Returns
19
+ .Do CommandSubHeading
20
+ .SetVar CommandLine1 The input string with any special characters converted to a format that the DrawTextWrapped
21
+ .SetVar CommandLine1 %CommandLine1% command can use to output the string correctly.
22
+ .Do CommandLine2
23
+
24
+ .SetVar CommandSubHeading Notes
25
+ .Do CommandSubHeading
26
+ .SetVar LongText If the input string is null or undefined then an empty is returned.
27
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %LongText%
28
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,27 @@
1
+ .SetVar CommandName processCommands()
2
+ .Do CommandHeading
3
+ .DrawText 0 %_CurrentY% This method processes the commands provided in an array of strings.
4
+
5
+ .SetVar CommandSubHeading Syntax
6
+ .Do CommandSubHeading
7
+ .SetVar CommandLine1 myJsPdfDynamo.processCommands(commands)
8
+ .Do CommandLine2
9
+
10
+ .SetVar CommandSubHeading Parameters
11
+ .Do CommandSubHeading
12
+ .SetVar CommandLine1 commands
13
+ .SetVar CommandLine2 An array of strings containing commands to process.
14
+ .Do CommandLine2
15
+
16
+ .SetVar CommandSubHeading Notes
17
+ .Do CommandSubHeading
18
+ .SetVar text The commands may (optionally) create the final document using the .SavePdf command.
19
+ .SetVar text %text% Alternatively, additional calls may be made to the processCommands method and/or
20
+ .SetVar text %text% the PDF document can be retrieved using the toBlob or toBlobUrl methods.
21
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
22
+
23
+ .SetVar CommandSubHeading See Also
24
+ .Do CommandSubHeading
25
+ .SetVar CommandLine1 SavePdf, toBlob, toBlobUrl
26
+ .Do CommandLine2
27
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,19 @@
1
+ .SetVar CommandName toBlob()
2
+ .Do CommandHeading
3
+ .DrawText 0 %_CurrentY% This method returns the contents of the current PDF as a Blob.
4
+
5
+ .SetVar CommandSubHeading Syntax
6
+ .Do CommandSubHeading
7
+ .SetVar CommandLine1 const myBlob = myJsPdfDynamo.toBlob();
8
+ .Do CommandLine2
9
+
10
+ .SetVar CommandSubHeading Returns
11
+ .Do CommandSubHeading
12
+ .SetVar CommandLine1 A JavaScript Blob containing the current PDF.
13
+ .Do CommandLine2
14
+
15
+ .SetVar CommandSubHeading See Also
16
+ .Do CommandSubHeading
17
+ .SetVar CommandLine1 ProcessCommands, SavePdf, toBlobUri
18
+ .Do CommandLine2
19
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,36 @@
1
+ .SetVar CommandName toBlobUrl()
2
+ .Do CommandHeading
3
+ .SetVar text This is a browser only method that generates the current PDF as a Blob
4
+ .SetVar text %text% and returns a string containing a URL to that Blob. This can be
5
+ .SetVar text %text% used to display the PDF in the current or another browser window.
6
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
7
+
8
+ .SetVar CommandSubHeading Syntax
9
+ .Do CommandSubHeading
10
+ .SetVar CommandLine1 const blobUrl = myJsPdfDynamo.toBlobUrl();
11
+ .Do CommandLine2
12
+
13
+ .SetVar CommandSubHeading Returns
14
+ .Do CommandSubHeading
15
+ .SetVar CommandLine1 A string containing the URL reference to the PDF.
16
+ .Do CommandLine2
17
+
18
+ .SetVar CommandSubHeading Example
19
+ .Do CommandSubHeading
20
+ .SetVar CommandLine1 Display the PDF in a new browser window:
21
+ .Do CommandLine
22
+ .incCurrentY %halfLineGap%
23
+ .SetVar CommandLine1 const blobUrl = myJsPdfDynamo.toBlobUrl();
24
+ .Do CommandLine2
25
+ .SetVar CommandLine1 if (blobUrl) {
26
+ .Do CommandLine2
27
+ .SetVar CommandLine1 window.open(blobUrl, '_blank');
28
+ .Do CommandLine2
29
+ .SetVar CommandLine1 }
30
+ .Do CommandLine2
31
+
32
+ .SetVar CommandSubHeading See Also
33
+ .Do CommandSubHeading
34
+ .SetVar CommandLine1 ProcessCommands, SavePdf, toBlob
35
+ .Do CommandLine2
36
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,36 @@
1
+ .SetVar ChapterName Variables
2
+ .do ChapterHeading
3
+
4
+ .DrawText 0 %_CurrentY% Variables can be used to substitute fixed text within a template. There are two kinds of variable:
5
+ .incCurrentY %halfLineGap%
6
+ .SetVar CommandLine1 * System variables. These are updated automatically and can not be changed directly.
7
+ .Do CommandLine2
8
+ .SetVar CommandLine1 * User defined variables which can be updated by commands in the script.
9
+ .Do CommandLine2
10
+ .incCurrentY %halfLineGap%
11
+ .DrawText 0 %_CurrentY% Commands are described in a following chapter.
12
+
13
+ .incCurrentY %_FontHeight%
14
+ .DrawText 0 %_CurrentY% Variables are referenced by enclosing them in percentage symbols. For example, to write some
15
+ .DrawText 0 %_CurrentY% text at the current position on the page the following DrawText command can be used:
16
+ .incCurrentY %_FontHeight%
17
+ .SetVar CommandLine1 .DrawText %%%%_CurrentX%%%% %%%%_CurrentY%%%% Hello World!
18
+ .Do CommandLine2
19
+ .incCurrentY %_FontHeight%
20
+ .DrawText 0 %_CurrentY% Variables (and commands) are not case sensitive and the above command could also be given
21
+ .DrawText 0 %_CurrentY% as:
22
+ .incCurrentY %_FontHeight%
23
+ .SetVar CommandLine1 .drawTEXT %%%%_currentX%%%% %%%%_CURRENTy%%%% Hello World!
24
+ .Do CommandLine2
25
+ .incCurrentY %_FontHeight%
26
+ .DrawText 0 %_CurrentY% Variables are stored as strings though there is a limited capability to perform arithmatic on
27
+ .DrawText 0 %_CurrentY% variables. For example, the .IncVar command can be used to add or subtract a number from
28
+ .DrawText 0 %_CurrentY% a variable.
29
+ .incCurrentY %_FontHeight%
30
+ .DrawText 0 %_CurrentY% Variables do not have to be assigned a value before being used.
31
+ .DrawText 0 %_CurrentY% The value of a variable referenced before being assigned a value is an empty string.
32
+ .incCurrentY %_FontHeight%
33
+ .DrawText 0 %_CurrentY% All variables are global, there is no scoping of variables within a group. A variable
34
+ .DrawText 0 %_CurrentY% defined within a group is available to commands run after that group.
35
+ .incCurrentY %_FontHeight%
36
+
@@ -0,0 +1,190 @@
1
+ .SetVar CommandName System Maintained Variables
2
+ .Do CommandHeading
3
+
4
+ .incCurrentY %halfLineGap%
5
+ .SetVar text JsPdfDynamo maintains and updates various variables as each command is processed. These
6
+ .SetVar text %text% variables can not be changed directly by using the SetVar command. They include:
7
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %LongText%
8
+ .incCurrentY %halfLineGap%
9
+ .SetMargin L 20
10
+
11
+ .SetVar CommandLine1 _CurrentX
12
+ .SetVar CommandLine2 The current horizontal position on the page, relative to the left margin, in
13
+ .Do VariableLine
14
+ .SetVar CommandLine2 millimeters.
15
+ .Do VariableLine
16
+
17
+ .incCurrentY %halfLineGap%
18
+ .SetVar CommandLine1 _CurrentY
19
+ .SetVar CommandLine2 The current vertical position on the page, relative to the top margin, in
20
+ .Do VariableLine
21
+ .SetVar CommandLine2 millimeters.
22
+ .Do VariableLine
23
+
24
+ .incCurrentY %halfLineGap%
25
+ .SetVar CommandLine1 _CurrentPageSize
26
+ .SetVar CommandLine2 The name of the last page size specified, for example, 'A4', 'Letter'.
27
+ .Do VariableLineWide
28
+
29
+ .incCurrentY %halfLineGap%
30
+ .SetVar CommandLine1 _CurrentPageOrientation
31
+ .SetVar CommandLine2 The last page orientation specified:
32
+ .Do VariableLineWide
33
+ .SetVar CommandLine2 0=Portrait (default) 1=Landscape
34
+ .Do VariableLineWide
35
+
36
+ .incCurrentY %halfLineGap%
37
+ .SetVar CommandLine1 _FontHeight
38
+ .SetVar CommandLine2 The height of the current font, in millimeters. This can be used to create
39
+ .Do VariableLine
40
+ .SetVar CommandLine2 a space between paragraphs when used in conjunction with the
41
+ .Do VariableLine
42
+ .SetVar CommandLine2 incCurrentY command: .incCurrentY %%%%_FontHeight%%%%
43
+ .Do VariableLine
44
+
45
+ .incCurrentY %halfLineGap%
46
+ .SetVar CommandLine1 _FontPointSize
47
+ .SetVar CommandLine2 The size of the current font in points. The default font size is 12 points.
48
+ .Do VariableLine
49
+
50
+ .incCurrentY %halfLineGap%
51
+ .SetVar CommandLine1 _FontStyle
52
+ .SetVar CommandLine2 The current font style. For example, "normal" or "italic".
53
+ .Do VariableLine
54
+
55
+ .incCurrentY %halfLineGap%
56
+ .SetVar CommandLine1 _FontType
57
+ .SetVar CommandLine2 The name of the current font. For example, "Helvetica", which is the
58
+ .Do VariableLine
59
+ .SetVar CommandLine2 default font type.
60
+ .Do VariableLine
61
+
62
+ .incCurrentY %halfLineGap%
63
+ .SetVar CommandLine1 _ImageHeight
64
+ .SetVar CommandLine2 The height of the last loaded image in the current units of measure.
65
+ .Do VariableLine
66
+
67
+ .incCurrentY %halfLineGap%
68
+ .SetVar CommandLine1 _ImageHeightPx
69
+ .SetVar CommandLine2 The height of the last loaded image in pixels.
70
+ .Do VariableLine
71
+
72
+ .incCurrentY %halfLineGap%
73
+ .SetVar CommandLine1 _ImageWidth
74
+ .SetVar CommandLine2 The width of the last loaded image in the current units of measure.
75
+ .Do VariableLine
76
+
77
+ .incCurrentY %halfLineGap%
78
+ .SetVar CommandLine1 _ImageWidthPx
79
+ .SetVar CommandLine2 The width of the last loaded image in pixels.
80
+ .Do VariableLine
81
+
82
+ .incCurrentY %halfLineGap%
83
+ .SetVar CommandLine1 _LastError
84
+ .SetVar CommandLine2 A description of the last error encountered.
85
+ .Do VariableLine
86
+
87
+ .incCurrentY %halfLineGap%
88
+ .SetVar CommandLine1 _LastImageAdded
89
+ .SetVar CommandLine2 The zero based index of the last image added to the PDF, either from a file or from a URL.
90
+ .Do VariableLineWrapped
91
+
92
+ .SetVar CommandLine1 _LastImageIndex
93
+ .SetVar CommandLine2 The index of the last drawn image.
94
+ .Do VariableLineWrapped
95
+
96
+ .incCurrentY %halfLineGap%
97
+ .SetVar CommandLine1 _LastObjectHeight
98
+ .SetVar CommandLine2 The height of the last object that has been output, in millimeters.
99
+ .Do VariableLine
100
+
101
+ .incCurrentY %halfLineGap%
102
+ .SetVar CommandLine1 _LastObjectWidth
103
+ .SetVar CommandLine2 The width of the last object that has been output, in millimeters.
104
+ .Do VariableLine
105
+
106
+ .incCurrentY %halfLineGap%
107
+ .SetVar CommandLine1 _LastOutline
108
+ .SetVar CommandLine2 This contains the number assigned to each outline entry when it is
109
+ .Do VariableLine
110
+ .SetVar CommandLine2 created. This number is used when creating child outline entries.
111
+ .Do VariableLine
112
+
113
+ .incCurrentY %halfLineGap%
114
+ .SetVar CommandLine1 _LastResult
115
+ .SetVar CommandLine2 Most commands update this variable. If the command fails, this will be
116
+ .Do VariableLine
117
+ .SetVar CommandLine2 set to '0'. A successful command wil set this to '1' or to some other
118
+ .Do VariableLine
119
+ .SetVar CommandLine2 useful value. For example, when a new page is created the page number
120
+ .Do VariableLine
121
+ .SetVar CommandLine2 is returned in this variable.
122
+ .Do VariableLine
123
+
124
+ .incCurrentY %halfLineGap%
125
+ .SetVar CommandLine1 _MarginBottom
126
+ .SetVar CommandLine2 The current margin, in millimeters, from the page bottom edge.
127
+ .Do VariableLine
128
+
129
+ .incCurrentY %halfLineGap%
130
+ .SetVar CommandLine1 _MarginLeft
131
+ .SetVar CommandLine2 The current margin, in millimeters, from the page left edge.
132
+ .Do VariableLine
133
+
134
+ .incCurrentY %halfLineGap%
135
+ .SetVar CommandLine1 _MarginRight
136
+ .SetVar CommandLine2 The current margin, in millimeters, from the page right edge.
137
+ .Do VariableLine
138
+
139
+ .incCurrentY %halfLineGap%
140
+ .SetVar CommandLine1 _MarginTop
141
+ .SetVar CommandLine2 The current margin, in millimeters, from the page top edge.
142
+ .Do VariableLine
143
+
144
+ .incCurrentY %halfLineGap%
145
+ .SetVar CommandLine1 _PageNo
146
+ .SetVar CommandLine2 The current page number, starting from 1 for the first page.
147
+ .Do VariableLine
148
+
149
+ .incCurrentY %halfLineGap%
150
+ .SetVar CommandLine1 _PageHeight
151
+ .SetVar CommandLine2 The height of the page, less the current top and bottom margins,
152
+ .Do VariableLine
153
+ .SetVar CommandLine2 expressed in millimeters.
154
+ .Do VariableLine
155
+
156
+ .incCurrentY %halfLineGap%
157
+ .SetVar CommandLine1 _Pages
158
+ .SetVar CommandLine2 The total number of pages in the document.
159
+ .Do VariableLine
160
+
161
+ .incCurrentY %halfLineGap%
162
+ .SetVar CommandLine1 _PageWidth
163
+ .SetVar CommandLine2 The width of the page, less the current left and right margins, expressed
164
+ .Do VariableLine
165
+ .SetVar CommandLine2 in millimeters.
166
+ .Do VariableLine
167
+
168
+ .incCurrentY %halfLineGap%
169
+ .SetVar CommandLine1 _SpaceHoz
170
+ .SetVar CommandLine2 JsPdfDynamo keeps track of the current position, relative to the left
171
+ .Do VariableLine
172
+ .SetVar CommandLine2 margin, after each object is output. This position is calculated in
173
+ .Do VariableLine
174
+ .SetVar CommandLine2 millimeters from the width of the object plus the current horizontal spacing,
175
+ .Do VariableLine
176
+ .SetVar CommandLine2 which can be set with the SetSpaceHoz command.
177
+ .Do VariableLine
178
+
179
+ .incCurrentY %halfLineGap%
180
+ .SetVar CommandLine1 _SpaceVert
181
+ .SetVar CommandLine2 JsPdfDynamo keeps track of the current position, in millimeters, relative
182
+ .Do VariableLine
183
+ .SetVar CommandLine2 to the top margin, after each object is output. This position is calculated
184
+ .Do VariableLine
185
+ .SetVar CommandLine2 from the height of the object plus the current vertical spacing, which can
186
+ .Do VariableLine
187
+ .SetVar CommandLine2 be set with the SetSpaceVert command.
188
+ .Do VariableLine
189
+ .incCurrentY %_SPACEVERT%
190
+ .Do SetMargins
@@ -0,0 +1,47 @@
1
+ .SetVar CommandName AddBookmark
2
+ .Do CommandHeading
3
+ .SetVar text Adds an entry to the document bookmarks. (Bookmarks
4
+ .SetVar text %text% also known as Table of Contents, Sidebar Reference, or Outlines.)
5
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
6
+
7
+ .SetVar CommandSubHeading Syntax
8
+ .Do CommandSubHeading
9
+ .SetVar CommandLine1 .AddBookmark ParentId PageNo Text
10
+ .Do CommandLine2
11
+
12
+ .SetVar CommandSubHeading Parameters
13
+ .Do CommandSubHeading
14
+ .SetVar CommandLine1 ParentId
15
+ .SetVar CommandLine2 The Id of the parent bookmark for this entry. Set to zero to create
16
+ .SetVar CommandLine2 %CommandLine2% a new top level bookmark.
17
+ .Do CommandLine2
18
+ .SetVar CommandLine1 PageNo
19
+ .SetVar CommandLine2 The page number to which this bookmark refers to.
20
+ .Do CommandLine2
21
+ .SetVar CommandLine1 Text
22
+ .SetVar CommandLine2 The text for this bookmark.
23
+ .Do CommandLine2
24
+
25
+ .SetVar CommandSubHeading Other
26
+ .Do CommandSubHeading
27
+ .SetVar CommandLine1 If successful then the variable _LastResult is set to the Id of the bookmark just created, else
28
+ .Do CommandLine
29
+ .SetVar CommandLine1 it is set to '0'.
30
+ .Do CommandLine
31
+
32
+ .SetVar CommandSubHeading Examples
33
+ .Do CommandSubHeading
34
+ .SetVar CommandLine1 Create a top level bookmark entry for the current page:
35
+ .Do CommandLine
36
+ .incCurrentY %halfLineGap%
37
+ .SetVar CommandLine1 .AddBookmark 0 %%%%_PAGENO%%%% Chapter one of the document
38
+ .Do CommandLine2
39
+ .SetVar CommandLine1 .SetVar Chapter1 %%%%_LastResult%%%%
40
+ .Do CommandLine2
41
+ .incCurrentY %_FontHeight%
42
+ .SetVar CommandLine1 Create a child bookmark entry for the chapter 1:
43
+ .Do CommandLine
44
+ .incCurrentY %halfLineGap%
45
+ .SetVar CommandLine1 .AddBookmark %%%%Chapter1%%%% %%%%_PAGENO%%%% Chapter one, Paragraph 1
46
+ .Do CommandLine2
47
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,59 @@
1
+ .SetVar CommandName AddImageFromFile (NodeJs Only)
2
+ .Do CommandHeading
3
+ .SetVar text Reads an image from the file system and stores it for later output. JsPdfDynamo can use all image types
4
+ .SetVar text %text% that jsPDF supports, including: BMP, GIF, JPEG, PNG, TIFF and WEBP
5
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
6
+ .incCurrentY %halfLineGap%
7
+
8
+ .SetVar CommandSubHeading Syntax
9
+ .Do CommandSubHeading
10
+ .SetVar CommandLine1 .AddImageFromFile FileName
11
+ .Do CommandLine2
12
+
13
+ .SetVar CommandSubHeading Parameters
14
+ .Do CommandSubHeading
15
+ .SetVar CommandLine1 FileName
16
+ .SetVar CommandLine2 The name and relative path to the image file to be read.
17
+ .Do CommandLine2
18
+
19
+ .SetVar CommandSubHeading Other
20
+ .Do CommandSubHeading
21
+ .SetVar CommandLine1 If successful then the variable _LastResult is set '1', else it is set to '0'.
22
+ .Do CommandLine
23
+ .incCurrentY %halfLineGap%
24
+ .SetVar CommandLine1 If successful then several other variables are also set:
25
+ .Do CommandLine
26
+ .incCurrentY %halfLineGap%
27
+ .SetVar CommandLine1c _ImageHeight is set to the height of the image in the current units of measure.
28
+ .Do CommandLine2
29
+ .SetVar CommandLine1c _ImageHeightPx is set to the height of the image pixels.
30
+ .Do CommandLine2
31
+ .SetVar CommandLine1c _ImageWidth is set to the width of the image in the current units of measure.
32
+ .Do CommandLine2
33
+ .SetVar CommandLine1c _ImageWidthPx is set to the width of the image pixels.
34
+ .Do CommandLine2
35
+ .SetVar CommandLine1c _LastImageAdded is the Id of the image just loaded. This is used when adding the image to the document.
36
+ .Do CommandLine2
37
+ .incCurrentY %halfLineGap%
38
+ .SetVar CommandLine1 An image only needs to be loaded once, but it can be drawn multiple times in the document
39
+ .SetVar CommandLine1 %CommandLine1% by referring to the image's Id.
40
+ .Do CommandLine
41
+
42
+ .SetVar CommandSubHeading Examples
43
+ .Do CommandSubHeading
44
+ .SetVar CommandLine1 Read a logo from an image and add it to the top left of the current page.
45
+ .Do CommandLine
46
+ .incCurrentY %halfLineGap%
47
+ .SetVar CommandLine1 .AddImageFromFile ../images/myLogo.jpg
48
+ .Do CommandLine2
49
+ .SetVar CommandLine1 .SetVar IdLogo %%%%_LastImageAdded%%%%
50
+ .Do CommandLine2
51
+ .SetVar CommandLine1 .DrawImage %%%%IdLogo%%%% 0 0 1
52
+ .Do CommandLine2
53
+ .incCurrentY %_FontHeight%
54
+
55
+ .SetVar CommandSubHeading See Also
56
+ .Do CommandSubHeading
57
+ .SetVar CommandLine1 AddImageFromUrl, DrawImage
58
+ .Do CommandLine2
59
+ .incCurrentY %_FontHeight%
@@ -0,0 +1,63 @@
1
+ .SetVar CommandName AddImageFromUrl
2
+ .Do CommandHeading
3
+ .SetVar text Reads an image from the given URL and stores it for later output. JsPdfDynamo can use all image types
4
+ .SetVar text %text% that jsPDF supports, including: BMP, GIF, JPEG, PNG, TIFF and WEBP
5
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
6
+ .incCurrentY %halfLineGap%
7
+ .SetVar text This command is available for both browser and NodeJs applications.
8
+ .DrawTextWrapped 0 %_CurrentY% %_PageWidth% CommandCheckPage %text%
9
+ .incCurrentY %halfLineGap%
10
+
11
+ .SetVar CommandSubHeading Syntax
12
+ .Do CommandSubHeading
13
+ .SetVar CommandLine1 .AddImageFromUrl URL
14
+ .Do CommandLine2
15
+
16
+ .SetVar CommandSubHeading Parameters
17
+ .Do CommandSubHeading
18
+ .SetVar CommandLine1 URL
19
+ .SetVar CommandLine2 The URL to the image file to be read.
20
+ .Do CommandLine2
21
+
22
+ .SetVar CommandSubHeading Other
23
+ .Do CommandSubHeading
24
+ .SetVar CommandLine1 If successful then the variable _LastResult is set '1', else it is set to '0'.
25
+ .Do CommandLine
26
+ .incCurrentY %halfLineGap%
27
+ .SetVar CommandLine1 If successful then several other variables are also set:
28
+ .Do CommandLine
29
+ .incCurrentY %halfLineGap%
30
+ .SetVar CommandLine1c _ImageHeight is set to the height of the image in the current units of measure.
31
+ .Do CommandLine2
32
+ .SetVar CommandLine1c _ImageHeightPx is set to the height of the image pixels.
33
+ .Do CommandLine2
34
+ .SetVar CommandLine1c _ImageWidth is set to the width of the image in the current units of measure.
35
+ .Do CommandLine2
36
+ .SetVar CommandLine1c _ImageWidthPx is set to the width of the image pixels.
37
+ .Do CommandLine2
38
+ .SetVar CommandLine1c _LastImageAdded is Id of the image just loaded. This is used when adding the image to the document.
39
+ .Do CommandLine2
40
+ .incCurrentY %halfLineGap%
41
+ .SetVar CommandLine1 An image only needs to be loaded once, but it can be drawn multiple times in the document
42
+ .SetVar CommandLine1 %CommandLine1% by referring to the image's Id.
43
+ .Do CommandLine
44
+
45
+ .SetVar CommandSubHeading Examples
46
+ .Do CommandSubHeading
47
+ .SetVar CommandLine1 Read a logo from an image and add it to the top left of the current page.
48
+ .Do CommandLine
49
+ .incCurrentY %halfLineGap%
50
+ .SetVar CommandLine1 .AddImageFromUrl /images/logo.png
51
+ .Do CommandLine2
52
+ .SetVar CommandLine1 .SetVar IdLogo %%%%_LastImageAdded%%%%
53
+ .Do CommandLine2
54
+ .SetVar CommandLine1 .DrawImage %%%%IdLogo%%%% 0 0 1
55
+ .Do CommandLine2
56
+ .incCurrentY %_FontHeight%
57
+
58
+ .SetVar CommandSubHeading See Also
59
+ .Do CommandSubHeading
60
+ .SetVar CommandLine1 AddImageFromFile, DrawImage
61
+ .Do CommandLine2
62
+
63
+ .incCurrentY %_FontHeight%