@digicole/pdfmake-rtl 2.1.0 → 2.1.2

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 (65) hide show
  1. package/CHANGELOG.md +118 -83
  2. package/README.md +11 -10
  3. package/build/pdfmake.js +71 -42
  4. package/build/pdfmake.js.map +1 -1
  5. package/build/pdfmake.min.js +2 -2
  6. package/build/pdfmake.min.js.map +1 -1
  7. package/build/vfs_fonts.js +11 -11
  8. package/js/3rd-party/svg-to-pdfkit/source.js +3823 -0
  9. package/js/3rd-party/svg-to-pdfkit.js +7 -0
  10. package/js/DocMeasure.js +713 -0
  11. package/js/DocPreprocessor.js +275 -0
  12. package/js/DocumentContext.js +310 -0
  13. package/js/ElementWriter.js +687 -0
  14. package/js/LayoutBuilder.js +1240 -0
  15. package/js/Line.js +113 -0
  16. package/js/OutputDocument.js +64 -0
  17. package/js/OutputDocumentServer.js +29 -0
  18. package/js/PDFDocument.js +144 -0
  19. package/js/PageElementWriter.js +161 -0
  20. package/js/PageSize.js +74 -0
  21. package/js/Printer.js +351 -0
  22. package/js/Renderer.js +417 -0
  23. package/js/SVGMeasure.js +92 -0
  24. package/js/StyleContextStack.js +191 -0
  25. package/js/TableProcessor.js +575 -0
  26. package/js/TextBreaker.js +166 -0
  27. package/js/TextDecorator.js +152 -0
  28. package/js/TextInlines.js +244 -0
  29. package/js/URLResolver.js +43 -0
  30. package/js/base.js +59 -0
  31. package/js/browser-extensions/OutputDocumentBrowser.js +82 -0
  32. package/js/browser-extensions/fonts/Cairo.js +38 -0
  33. package/js/browser-extensions/fonts/Roboto.js +38 -0
  34. package/js/browser-extensions/index.js +59 -0
  35. package/js/browser-extensions/pdfMake.js +3 -0
  36. package/js/browser-extensions/standard-fonts/Courier.js +38 -0
  37. package/js/browser-extensions/standard-fonts/Helvetica.js +38 -0
  38. package/js/browser-extensions/standard-fonts/Symbol.js +23 -0
  39. package/js/browser-extensions/standard-fonts/Times.js +38 -0
  40. package/js/browser-extensions/standard-fonts/ZapfDingbats.js +23 -0
  41. package/js/browser-extensions/virtual-fs-cjs.js +3 -0
  42. package/js/columnCalculator.js +148 -0
  43. package/js/helpers/node.js +123 -0
  44. package/js/helpers/tools.js +46 -0
  45. package/js/helpers/variableType.js +59 -0
  46. package/js/index.js +15 -0
  47. package/js/qrEnc.js +721 -0
  48. package/js/rtlUtils.js +519 -0
  49. package/js/standardPageSizes.js +56 -0
  50. package/js/tableLayouts.js +98 -0
  51. package/js/virtual-fs.js +60 -0
  52. package/package.json +1 -1
  53. package/src/{docMeasure.js → DocMeasure.js} +8 -8
  54. package/src/{elementWriter.js → ElementWriter.js} +3 -3
  55. package/src/{layoutBuilder.js → LayoutBuilder.js} +1406 -1393
  56. package/src/{tableProcessor.js → TableProcessor.js} +633 -620
  57. package/src/rtlUtils.js +503 -500
  58. /package/src/{docPreprocessor.js → DocPreprocessor.js} +0 -0
  59. /package/src/{documentContext.js → DocumentContext.js} +0 -0
  60. /package/src/{line.js → Line.js} +0 -0
  61. /package/src/{pageElementWriter.js → PageElementWriter.js} +0 -0
  62. /package/src/{printer.js → Printer.js} +0 -0
  63. /package/src/{svgMeasure.js → SVGMeasure.js} +0 -0
  64. /package/src/{styleContextStack.js → StyleContextStack.js} +0 -0
  65. /package/src/{textDecorator.js → TextDecorator.js} +0 -0
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.convertToDynamicContent = convertToDynamicContent;
5
+ exports.offsetVector = offsetVector;
6
+ exports.pack = pack;
7
+ function pack(...args) {
8
+ let result = {};
9
+ for (let i = 0, l = args.length; i < l; i++) {
10
+ let obj = args[i];
11
+ if (obj) {
12
+ for (let key in obj) {
13
+ if (obj.hasOwnProperty(key)) {
14
+ result[key] = obj[key];
15
+ }
16
+ }
17
+ }
18
+ }
19
+ return result;
20
+ }
21
+ function offsetVector(vector, x, y) {
22
+ switch (vector.type) {
23
+ case 'ellipse':
24
+ case 'rect':
25
+ vector.x += x;
26
+ vector.y += y;
27
+ break;
28
+ case 'line':
29
+ vector.x1 += x;
30
+ vector.x2 += x;
31
+ vector.y1 += y;
32
+ vector.y2 += y;
33
+ break;
34
+ case 'polyline':
35
+ for (let i = 0, l = vector.points.length; i < l; i++) {
36
+ vector.points[i].x += x;
37
+ vector.points[i].y += y;
38
+ }
39
+ break;
40
+ }
41
+ }
42
+ function convertToDynamicContent(staticContent) {
43
+ return () =>
44
+ // copy to new object
45
+ JSON.parse(JSON.stringify(staticContent));
46
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.isEmptyObject = isEmptyObject;
5
+ exports.isNumber = isNumber;
6
+ exports.isObject = isObject;
7
+ exports.isPositiveInteger = isPositiveInteger;
8
+ exports.isString = isString;
9
+ exports.isValue = isValue;
10
+ /**
11
+ * @param {any} variable
12
+ * @returns {boolean}
13
+ */
14
+ function isString(variable) {
15
+ return typeof variable === 'string' || variable instanceof String;
16
+ }
17
+
18
+ /**
19
+ * @param {any} variable
20
+ * @returns {boolean}
21
+ */
22
+ function isNumber(variable) {
23
+ return (typeof variable === 'number' || variable instanceof Number) && !Number.isNaN(variable);
24
+ }
25
+
26
+ /**
27
+ * @param {any} variable
28
+ * @returns {boolean}
29
+ */
30
+ function isPositiveInteger(variable) {
31
+ if (!isNumber(variable) || !Number.isInteger(variable) || variable <= 0) {
32
+ return false;
33
+ }
34
+ return true;
35
+ }
36
+
37
+ /**
38
+ * @param {any} variable
39
+ * @returns {boolean}
40
+ */
41
+ function isObject(variable) {
42
+ return variable !== null && !Array.isArray(variable) && !isString(variable) && !isNumber(variable) && typeof variable === 'object';
43
+ }
44
+
45
+ /**
46
+ * @param {any} variable
47
+ * @returns {boolean}
48
+ */
49
+ function isEmptyObject(variable) {
50
+ return isObject(variable) && Object.keys(variable).length === 0;
51
+ }
52
+
53
+ /**
54
+ * @param {any} variable
55
+ * @returns {boolean}
56
+ */
57
+ function isValue(variable) {
58
+ return variable !== undefined && variable !== null;
59
+ }
package/js/index.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ const pdfmakeBase = require('./base').default;
4
+ const OutputDocumentServer = require('./OutputDocumentServer').default;
5
+ const URLResolver = require('./URLResolver').default;
6
+ class pdfmake extends pdfmakeBase {
7
+ constructor() {
8
+ super();
9
+ this.urlResolver = () => new URLResolver(this.virtualfs);
10
+ }
11
+ _transformToDocument(doc) {
12
+ return new OutputDocumentServer(doc);
13
+ }
14
+ }
15
+ module.exports = new pdfmake();