abstract-document 6.7.0 → 6.8.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 (144) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/lib/abstract-document/atoms/toc-separator.d.ts +2 -0
  3. package/lib/abstract-document/atoms/toc-separator.d.ts.map +1 -1
  4. package/lib/abstract-document/atoms/toc-separator.js +2 -1
  5. package/lib/abstract-document/atoms/toc-separator.js.map +1 -1
  6. package/lib/abstract-document/styles/text-style.d.ts +0 -3
  7. package/lib/abstract-document/styles/text-style.d.ts.map +1 -1
  8. package/lib/abstract-document/styles/text-style.js +1 -2
  9. package/lib/abstract-document/styles/text-style.js.map +1 -1
  10. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-no-underline.d.ts +3 -0
  11. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-no-underline.d.ts.map +1 -0
  12. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-no-underline.js +114 -0
  13. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-no-underline.js.map +1 -0
  14. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-with-underline.d.ts +3 -0
  15. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-with-underline.d.ts.map +1 -0
  16. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-with-underline.js +114 -0
  17. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-with-underline.js.map +1 -0
  18. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink copy.d.ts +3 -0
  19. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink copy.d.ts.map +1 -0
  20. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink copy.js +65 -0
  21. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink copy.js.map +1 -0
  22. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-no-underline.d.ts +3 -0
  23. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-no-underline.d.ts.map +1 -0
  24. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-no-underline.js +85 -0
  25. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-no-underline.js.map +1 -0
  26. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-with-underline.d.ts +3 -0
  27. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-with-underline.d.ts.map +1 -0
  28. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-with-underline.js +85 -0
  29. package/lib/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-with-underline.js.map +1 -0
  30. package/lib/abstract-document-exporters/pdf/render.js +10 -9
  31. package/lib/abstract-document-exporters/pdf/render.js.map +1 -1
  32. package/package.json +2 -3
  33. package/src/abstract-document/atoms/toc-separator.ts +6 -2
  34. package/src/abstract-document-exporters/__tests__/docx2/tmp/Group.docx +0 -0
  35. package/src/abstract-document-exporters/__tests__/docx2/tmp/Header and footer.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Header → footer.docx +0 -0
  36. package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed hyperlink and textrun.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed hyperlink → textrun.docx +0 -0
  37. package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed textrun and images.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed textrun → images.docx +0 -0
  38. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple images.docx +0 -0
  39. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple tables.docx +0 -0
  40. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Center alignment.docx +0 -0
  41. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with End alignment.docx +0 -0
  42. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment that linebreaks.docx +0 -0
  43. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment.docx +0 -0
  44. package/src/abstract-document-exporters/__tests__/docx2/tmp/Page numbering.docx +0 -0
  45. package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table colSpan and rowSpan.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table colSpan → rowSpan.docx +0 -0
  46. package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table without rows.docx +0 -0
  47. package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table.docx +0 -0
  48. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single hyperlink.docx +0 -0
  49. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single image.docx +0 -0
  50. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment that linebreaks.docx +0 -0
  51. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment.docx +0 -0
  52. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment that linebreaks.docx +0 -0
  53. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment.docx +0 -0
  54. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment that linebreaks.docx +0 -0
  55. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment.docx +0 -0
  56. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun.docx +0 -0
  57. package/src/abstract-document-exporters/__tests__/docx2/tmp/hello.docx +0 -0
  58. package/src/abstract-document-exporters/__tests__/docx2/tmp/world.docx +0 -0
  59. package/src/abstract-document-exporters/__tests__/pdf/test-defs/absolute-position-header-and-footer.tsx +11 -3
  60. package/src/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-no-underline.tsx +114 -0
  61. package/src/abstract-document-exporters/__tests__/pdf/test-defs/mixed-hyperlink-and-textrun-with-underline.tsx +114 -0
  62. package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-no-underline.tsx +70 -0
  63. package/src/abstract-document-exporters/__tests__/pdf/test-defs/single-hyperlink-with-underline.tsx +70 -0
  64. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position group.pdf +2 -2
  65. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position header and footer.pdf +4 -4
  66. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position paragraph.pdf +2 -2
  67. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in group.pdf +2 -2
  68. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in table.pdf +2 -2
  69. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position table.pdf +2 -2
  70. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Paragraphs.pdf +2 -2
  71. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Tables.pdf +2 -2
  72. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group no keeptogether.pdf +2 -2
  73. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group too big for one page.pdf +2 -2
  74. package/src/abstract-document-exporters/__tests__/pdf/tmp/Header and footer.pdf +2 -2
  75. package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal linktarget.pdf +250 -682
  76. package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal.pdf +250 -682
  77. package/src/abstract-document-exporters/__tests__/pdf/tmp/Margins header body footer.pdf +2 -2
  78. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun no underline.pdf +180 -0
  79. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun with underline.pdf +192 -0
  80. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun.pdf +34 -60
  81. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed textrun and images.pdf and b/package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed textrun → images.pdf +0 -0
  82. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images overflow.pdf +0 -0
  83. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images.pdf +0 -0
  84. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Center alignment.pdf +2 -2
  85. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with End alignment.pdf +2 -2
  86. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment that linebreaks.pdf +2 -2
  87. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment.pdf +2 -2
  88. package/src/abstract-document-exporters/__tests__/pdf/tmp/Page numbering.pdf +2 -2
  89. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table row that doesnt fit page.pdf +2 -2
  90. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table single row.pdf +2 -2
  91. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with group.pdf +2 -2
  92. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header 2.pdf +2 -2
  93. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header.pdf +2 -2
  94. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin bottom.pdf +2 -2
  95. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top single table.pdf +2 -2
  96. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top.pdf +2 -2
  97. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan multipages.pdf +2 -2
  98. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan.pdf +2 -2
  99. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all auto.pdf +2 -2
  100. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all fix.pdf +2 -2
  101. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table background.pdf +2 -2
  102. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of image.pdf +0 -0
  103. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of text.pdf +2 -2
  104. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table center alignment.pdf +2 -2
  105. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table colSpan and rowSpan.pdf +2 -2
  106. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table mix auto fix.pdf +2 -2
  107. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table padding.pdf +2 -2
  108. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table right alignment.pdf +2 -2
  109. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table row alignment.pdf +2 -2
  110. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell with wrapping.pdf +2 -2
  111. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell.pdf +2 -2
  112. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with default colored borders.pdf +2 -2
  113. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with header.pdf +2 -2
  114. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with multi colored borders.pdf +2 -2
  115. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with single colored borders.pdf +2 -2
  116. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single date.pdf +14 -14
  117. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single figure.pdf +2 -2
  118. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink centered.pdf +29 -43
  119. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink no underline.pdf +146 -0
  120. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink right aligned.pdf +29 -43
  121. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink.pdf +29 -43
  122. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color hex.pdf +2 -2
  123. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color name.pdf +2 -2
  124. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color url.pdf +2 -2
  125. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image.pdf +0 -0
  126. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline alphabetic.pdf +2 -2
  127. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline bottom.pdf +2 -2
  128. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline hanging.pdf +2 -2
  129. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline middle.pdf +2 -2
  130. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline top.pdf +2 -2
  131. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment that linebreaks.pdf +2 -2
  132. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment.pdf +2 -2
  133. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment that linebreaks.pdf +2 -2
  134. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment.pdf +2 -2
  135. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Justify alignment.pdf +2 -2
  136. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment that linebreaks.pdf +2 -2
  137. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment.pdf +2 -2
  138. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with super and subscripts.pdf +2 -2
  139. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun.pdf +2 -2
  140. package/src/abstract-document-exporters/__tests__/pdf/tmp/Table of content separator.pdf +26 -40
  141. package/src/abstract-document-exporters/__tests__/pdf/tmp/hello.pdf +2 -2
  142. package/src/abstract-document-exporters/__tests__/pdf/tmp/world.pdf +2 -2
  143. package/src/abstract-document-exporters/pdf/render.ts +42 -30
  144. package/LICENSE +0 -21
@@ -16,19 +16,6 @@ endobj
16
16
  /F 4
17
17
  >>
18
18
  endobj
19
- 11 0 obj
20
- <<
21
- /align /left
22
- /Subtype /Underline
23
- /QuadPoints [0 840 22.78 840 0 828.44 22.78 828.44]
24
- /Contents ()
25
- /Type /Annot
26
- /Rect [0 828.44 22.78 840]
27
- /Border [0 0 0]
28
- /C [0 0 1]
29
- /Align /left
30
- >>
31
- endobj
32
19
  7 0 obj
33
20
  <<
34
21
  /Type /Page
@@ -36,7 +23,7 @@ endobj
36
23
  /MediaBox [0 0 595 842]
37
24
  /Contents 5 0 R
38
25
  /Resources 6 0 R
39
- /Annots [9 0 R 11 0 R]
26
+ /Annots [9 0 R]
40
27
  >>
41
28
  endobj
42
29
  6 0 obj
@@ -77,20 +64,20 @@ Q
77
64
 
78
65
  endstream
79
66
  endobj
80
- 13 0 obj
67
+ 12 0 obj
81
68
  (PDFKit)
82
69
  endobj
83
- 14 0 obj
70
+ 13 0 obj
84
71
  (PDFKit)
85
72
  endobj
86
- 15 0 obj
87
- (D:20220215122943Z)
73
+ 14 0 obj
74
+ (D:20220216115440Z)
88
75
  endobj
89
- 12 0 obj
76
+ 11 0 obj
90
77
  <<
91
- /Producer 13 0 R
92
- /Creator 14 0 R
93
- /CreationDate 15 0 R
78
+ /Producer 12 0 R
79
+ /Creator 13 0 R
80
+ /CreationDate 14 0 R
94
81
  >>
95
82
  endobj
96
83
  10 0 obj
@@ -128,30 +115,29 @@ endobj
128
115
  >>
129
116
  endobj
130
117
  xref
131
- 0 16
118
+ 0 15
132
119
  0000000000 65535 f
133
- 0000001335 00000 n
134
- 0000001392 00000 n
135
- 0000001273 00000 n
136
- 0000001252 00000 n
137
- 0000000574 00000 n
138
- 0000000484 00000 n
139
- 0000000357 00000 n
120
+ 0000001128 00000 n
121
+ 0000001185 00000 n
122
+ 0000001066 00000 n
123
+ 0000001045 00000 n
124
+ 0000000367 00000 n
125
+ 0000000277 00000 n
126
+ 0000000157 00000 n
140
127
  0000000015 00000 n
141
128
  0000000051 00000 n
142
- 0000001154 00000 n
143
- 0000000157 00000 n
144
- 0000001078 00000 n
145
- 0000000992 00000 n
146
- 0000001017 00000 n
147
- 0000001042 00000 n
129
+ 0000000947 00000 n
130
+ 0000000871 00000 n
131
+ 0000000785 00000 n
132
+ 0000000810 00000 n
133
+ 0000000835 00000 n
148
134
  trailer
149
135
  <<
150
- /Size 16
136
+ /Size 15
151
137
  /Root 3 0 R
152
- /Info 12 0 R
153
- /ID [<8a750fe54e8b7b7c776626edd30c9512> <8a750fe54e8b7b7c776626edd30c9512>]
138
+ /Info 11 0 R
139
+ /ID [<611486daff7347181a1808b301876f43> <611486daff7347181a1808b301876f43>]
154
140
  >>
155
141
  startxref
156
- 1439
142
+ 1232
157
143
  %%EOF
@@ -79,7 +79,7 @@ endobj
79
79
  (PDFKit)
80
80
  endobj
81
81
  15 0 obj
82
- (D:20220215122942Z)
82
+ (D:20220216115439Z)
83
83
  endobj
84
84
  12 0 obj
85
85
  <<
@@ -145,7 +145,7 @@ trailer
145
145
  /Size 16
146
146
  /Root 3 0 R
147
147
  /Info 12 0 R
148
- /ID [<0277c1a2bcf8027307a6a0802c9f6fb0> <0277c1a2bcf8027307a6a0802c9f6fb0>]
148
+ /ID [<c1726f588f634670baad2b659fd2fbbf> <c1726f588f634670baad2b659fd2fbbf>]
149
149
  >>
150
150
  startxref
151
151
  1212
@@ -43,7 +43,7 @@ endobj
43
43
  (PDFKit)
44
44
  endobj
45
45
  12 0 obj
46
- (D:20220215122943Z)
46
+ (D:20220216115440Z)
47
47
  endobj
48
48
  9 0 obj
49
49
  <<
@@ -106,7 +106,7 @@ trailer
106
106
  /Size 13
107
107
  /Root 3 0 R
108
108
  /Info 9 0 R
109
- /ID [<a38fd26bcbe3213b9bf7ac14dce2a0a6> <a38fd26bcbe3213b9bf7ac14dce2a0a6>]
109
+ /ID [<7e7b9497e2b770678124912c78130e86> <7e7b9497e2b770678124912c78130e86>]
110
110
  >>
111
111
  startxref
112
112
  837
@@ -113,7 +113,7 @@ function renderPage(
113
113
  headerY += style.headerMargins.bottom;
114
114
 
115
115
  const footerHeight = page.footer.reduce(
116
- (a, b) => a + getDesiredSize(b, desiredSizes).height,
116
+ (a, b) => a + (AD.Position.isPositionAbsolute(b) ? 0 : getDesiredSize(b, desiredSizes).height),
117
117
  style.footerMargins.top + style.footerMargins.bottom
118
118
  );
119
119
  const footerX = style.footerMargins.left;
@@ -383,7 +383,7 @@ function renderAtom(
383
383
  renderHyperLink(resources, pdf, finalRect, textStyle, atom, alignment, isFirstAtom, isLastAtom, availableWidth);
384
384
  return;
385
385
  case "TocSeparator":
386
- renderTocSeparator(pdf, finalRect, textStyle);
386
+ renderTocSeparator(pdf, finalRect, textStyle, atom);
387
387
  return;
388
388
  case "LinkTarget":
389
389
  return;
@@ -476,8 +476,13 @@ function renderHyperLink(
476
476
  drawHyperLink(pdf, finalRect, style, hyperLink, textAlignment, isFirstAtom, isLastAtom, availableWidth);
477
477
  }
478
478
 
479
- function renderTocSeparator(pdf: {}, finalRect: AD.Rect.Rect, textStyle: AD.TextStyle.TextStyle): void {
480
- drawDottedLine(pdf, finalRect, textStyle);
479
+ function renderTocSeparator(
480
+ pdf: {},
481
+ finalRect: AD.Rect.Rect,
482
+ textStyle: AD.TextStyle.TextStyle,
483
+ tocSeparator: AD.TocSeparator.TocSeparator
484
+ ): void {
485
+ drawDottedLine(pdf, finalRect, textStyle, tocSeparator);
481
486
  }
482
487
 
483
488
  function drawHyperLink(
@@ -513,34 +518,34 @@ function drawHyperLink(
513
518
  // so always set alignment to left and handle it through an x offset
514
519
  // if its just a single atom then we can use its alignment to partially support multi-line texts for other alignments
515
520
  if (isFirstAtom || alignment !== "left") {
516
- pdf
517
- .text(hyperLink.text, finalRect.x, finalRect.y, {
518
- width: availableWidth,
519
- underline: textStyle.underline || false,
520
- align: isSingleAtom ? alignment : "left",
521
- goTo: isInternalLink ? hyperLink.target.substr(1) : undefined,
522
- indent: textStyle.indent || 0,
523
- continued: alignment !== "left" ? false : !isLastAtom,
524
- baseline: textStyle.baseline || "top",
525
- ...(textStyle.lineGap !== undefined ? { lineGap: textStyle.lineGap } : {}),
526
- })
527
- .underline(xUnderline, finalRect.y + 2, finalRect.width, finalRect.height, {
521
+ pdf.text(hyperLink.text, finalRect.x, finalRect.y, {
522
+ width: availableWidth,
523
+ align: isSingleAtom ? alignment : "left",
524
+ goTo: isInternalLink ? hyperLink.target.substr(1) : undefined,
525
+ indent: textStyle.indent || 0,
526
+ continued: alignment !== "left" ? false : !isLastAtom,
527
+ baseline: textStyle.baseline || "top",
528
+ ...(textStyle.lineGap !== undefined ? { lineGap: textStyle.lineGap } : {}),
529
+ });
530
+ if (textStyle.underline === undefined ? true : textStyle.underline) {
531
+ pdf.underline(xUnderline, finalRect.y + 2, finalRect.width, finalRect.height, {
528
532
  align: isSingleAtom ? alignment : "left",
529
533
  color: "blue",
530
534
  });
535
+ }
531
536
  } else {
532
- pdf
533
- .text(hyperLink.text, {
534
- underline: textStyle.underline || false,
535
- align: "left",
536
- goTo: isInternalLink ? hyperLink.target.substr(1) : undefined,
537
- indent: textStyle.indent || 0,
538
- continued: !isLastAtom,
539
- ...(textStyle.lineGap !== undefined ? { lineGap: textStyle.lineGap } : {}),
540
- })
541
- .underline(xUnderline, finalRect.y + 2, finalRect.width, finalRect.height, {
537
+ pdf.text(hyperLink.text, {
538
+ align: "left",
539
+ goTo: isInternalLink ? hyperLink.target.substr(1) : undefined,
540
+ indent: textStyle.indent || 0,
541
+ continued: !isLastAtom,
542
+ ...(textStyle.lineGap !== undefined ? { lineGap: textStyle.lineGap } : {}),
543
+ });
544
+ if (textStyle.underline === undefined ? true : textStyle.underline) {
545
+ pdf.underline(xUnderline, finalRect.y + 2, finalRect.width, finalRect.height, {
542
546
  color: "blue",
543
547
  });
548
+ }
544
549
  }
545
550
 
546
551
  resetTextOffset(pdf, textStyle);
@@ -597,19 +602,26 @@ function drawText(
597
602
  resetTextOffset(pdf, textStyle);
598
603
  }
599
604
 
600
- function drawDottedLine(pdf: any, finalRect: AD.Rect.Rect, textStyle: AD.TextStyle.TextStyle): void {
605
+ function drawDottedLine(
606
+ pdf: any,
607
+ finalRect: AD.Rect.Rect,
608
+ textStyle: AD.TextStyle.TextStyle,
609
+ tocSeparator: AD.TocSeparator.TocSeparator
610
+ ): void {
601
611
  const font = getFontNameStyle(textStyle);
602
612
  const fontSize = AD.TextStyle.calculateFontSize(textStyle, 10);
603
613
 
614
+ const charSpacing = tocSeparator.width ? tocSeparator.width : 5;
615
+
604
616
  const oneDotW = pdf.widthOfString(".", {
605
617
  width: finalRect.width,
606
618
  height: finalRect.height,
607
- characterSpacing: 5,
619
+ characterSpacing: charSpacing,
608
620
  });
609
621
  const twoDotsW = pdf.widthOfString("..", {
610
622
  width: finalRect.width,
611
623
  height: finalRect.height,
612
- characterSpacing: 5,
624
+ characterSpacing: charSpacing,
613
625
  });
614
626
  const numberOfDots = Math.floor((finalRect.width - oneDotW) / (twoDotsW - oneDotW)) + 1;
615
627
  if (twoDotsW - oneDotW === 0 || numberOfDots < 1) {
@@ -633,7 +645,7 @@ function drawDottedLine(pdf: any, finalRect: AD.Rect.Rect, textStyle: AD.TextSty
633
645
  width: finalRect.width,
634
646
  height: finalRect.height,
635
647
  align: "right",
636
- characterSpacing: 5,
648
+ characterSpacing: charSpacing,
637
649
  });
638
650
  resetTextOffset(pdf, textStyle);
639
651
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Divid AB
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.