pdf-lib-extended 1.0.31 → 1.0.33

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.31",
3
+ "version": "1.0.33",
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": {
@@ -577,17 +577,12 @@ class PDFLibExtended {
577
577
 
578
578
  /*** BACKGROUND ***/
579
579
  if(defaultOptions.backgroundColor !== null){
580
+ let height = defaultOptions.height ? defaultOptions.height : change + defaultOptions.padding;
580
581
  page.drawRectangle({
581
582
  x: x,
582
- y: y,
583
+ y: y - (defaultOptions.height ? defaultOptions.height : (change / 2) + defaultOptions.padding),
583
584
  width: width,
584
- height: (
585
- (defaultOptions.height)
586
- ?
587
- defaultOptions.height
588
- :
589
- change + defaultOptions.padding
590
- ),
585
+ height: height,
591
586
  color: defaultOptions.backgroundColor
592
587
  });
593
588
  }