pdf-lib-extended 1.0.42 → 1.0.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-lib-extended",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "description": "This project extends the capabilities of the pdf-lib JavaScript library by providing a set of helper functions that simplify common PDF manipulation tasks. It includes utilities for drawing and formatting text, images, and shapes within PDF documents, allowing for more advanced customization and automation. The class-based architecture, designed as a toolkit, ensures that developers can easily integrate these enhanced features into their existing workflows. With this extension, users can streamline the creation of dynamic and complex PDFs with minimal effort.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -419,7 +419,7 @@ class PDFLibExtended {
419
419
  opacity: defaultOptions.opacity
420
420
  });
421
421
  if(defaultOptions.textDecoration === "underline"){
422
- this.pdf.drawLine({
422
+ this.getCurrentPage().drawLine({
423
423
  start: { x: this.getCurrentPage().getX(), y: this.getCurrentPage().getY() - 2 },
424
424
  end: { x: this.getCurrentPage().getX() + this.getCurrentFont().widthOfTextAtSize(text, defaultOptions.size), y: this.getCurrentPage().getY() - 2 },
425
425
  thickness: 1,
@@ -446,7 +446,7 @@ class PDFLibExtended {
446
446
  opacity: defaultOptions.opacity
447
447
  });
448
448
  if(defaultOptions.textDecoration === "underline"){
449
- this.pdf.drawLine({
449
+ this.getCurrentPage().drawLine({
450
450
  start: { x: xCenterPosition, y: this.getCurrentPage().getY() - 2 },
451
451
  end: { x: xCenterPosition + this.getCurrentFont().widthOfTextAtSize(text, defaultOptions.size), y: this.getCurrentPage().getY() - 2 },
452
452
  thickness: 1,
@@ -473,7 +473,7 @@ class PDFLibExtended {
473
473
  opacity: defaultOptions.opacity
474
474
  });
475
475
  if(defaultOptions.textDecoration === "underline"){
476
- this.pdf.drawLine({
476
+ this.getCurrentPage().drawLine({
477
477
  start: { x: xRightPosition, y: this.getCurrentPage().getY() - 2 },
478
478
  end: { x: xRightPosition + textWidth, y: this.getCurrentPage().getY() - 2 },
479
479
  thickness: 1,
@@ -513,6 +513,7 @@ class PDFLibExtended {
513
513
  padding: 0, // extra spacing between lines
514
514
  wordWrap: true,
515
515
  characterWrap: false,
516
+ textDecoration: null,
516
517
  ...options
517
518
  };
518
519
 
@@ -543,7 +544,8 @@ class PDFLibExtended {
543
544
  color: defaultOptions.color,
544
545
  opacity: defaultOptions.opacity,
545
546
  align: defaultOptions.align,
546
- range: defaultOptions.range
547
+ range: defaultOptions.range,
548
+ textDecoration: defaultOptions.textDecoration
547
549
  });
548
550
  let nextLineData = this.nextLine(defaultOptions.padding);
549
551
  totalHeight += nextLineData.addedSpace;
@@ -564,7 +566,8 @@ class PDFLibExtended {
564
566
  color: defaultOptions.color,
565
567
  opacity: defaultOptions.opacity,
566
568
  align: defaultOptions.align,
567
- range: defaultOptions.range
569
+ range: defaultOptions.range,
570
+ textDecoration: defaultOptions.textDecoration
568
571
  });
569
572
  }
570
573
  });