pdf-lib-extended 1.0.4 → 1.0.5
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 +1 -1
- package/src/PDFLibExtended.js +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-lib-extended",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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": {
|
package/src/PDFLibExtended.js
CHANGED
|
@@ -709,6 +709,7 @@ class PDFLibExtended {
|
|
|
709
709
|
align: "left",
|
|
710
710
|
color: this.getColor(),
|
|
711
711
|
size: this.getTextSize(),
|
|
712
|
+
indent: false,
|
|
712
713
|
...options,
|
|
713
714
|
}
|
|
714
715
|
if (defaultOptions.range && !parser) this.getCurrentPage().moveTo(defaultOptions.range.left, this.getCurrentPage().getY());
|
|
@@ -776,6 +777,11 @@ class PDFLibExtended {
|
|
|
776
777
|
/*** DRAW TEXT ***/
|
|
777
778
|
let splitText = text.data.split(" ");
|
|
778
779
|
splitText.forEach(string => {
|
|
780
|
+
if(defaultOptions.indent){
|
|
781
|
+
this.getCurrentPage().moveRight(30);
|
|
782
|
+
defaultOptions.indent = false;
|
|
783
|
+
}
|
|
784
|
+
|
|
779
785
|
string += " ";
|
|
780
786
|
let wordWidth = this.getCurrentFont().widthOfTextAtSize(string, defaultOptions.size);
|
|
781
787
|
if(wordWidth + this.getCurrentPage().getX() >= maxWidth){
|