![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
pdf-lib-extended
Advanced tools
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, all
PDF-lib-Extended is a JavaScript library that extends the functionality of the popular pdf-lib library. This extension adds several useful methods for working with PDF documents, making it easier to manipulate text, images, tables, and other elements within your PDFs.
To install PDF-lib-Extended, use npm:
npm install pdf-lib-extended
Here’s a basic example of how to use PDF-lib-Extended in your project:
import PDFExtended from 'pdf-lib-extended';
async function createPDF() {
const pdf = new PDFExtended();
await pdf.init();
// Add a new page
pdf.addNewPage();
// Draw some text
pdf.drawText('Hello, World!', {
align: 'center',
size: 24,
color: pdf.getColor(),
});
// Draw a circle with text inside
pdf.drawCircleText(100, 100, 'A', {
size: 12,
color: pdf.getColor(),
});
// Generate and download the PDF
const pdfUrl = await pdf.generatePDFURL();
window.open(pdfUrl);
}
createPDF();
PDF-lib-Extended includes several custom methods to enhance your PDF creation experience:
Text Handling:
drawText(text, options)
: Draws text on the current page with alignment, color, and size options.drawParagraph(text, options)
: Automatically wraps text to the next line within specified bounds.Shape Drawing:
drawCircleText(x, y, text, options)
: Draws a circle with text centered inside.Tables:
drawTable(header, data, options)
: Draws a table with customizable borders, alignment, and size.Images:
addImage(x, y, base64Image, imageScale)
: Adds an image to the PDF document at specified coordinates with optional scaling.Watermarks:
drawWatermark(text, size)
: Draws a watermark on each page of the document.Document Management:
addNewPage(dimensions)
: Adds a new page to the PDF document.fetchPDF(url)
: Fetches an existing PDF from a URL and loads it into the document.mergePDF(urls)
: Merges multiple PDFs from URLs into the current document.HTML Parsing:
htmlParser(text, parser, options)
: Parses HTML and draws it on the PDF.init()
Initializes the PDF document and embeds fonts.
setTextSize(number)
Sets the text size for the document.
setCircleScale(number)
Sets the scale for circles drawn on the document.
setMargin(arr)
Sets the margins for the document.
setCurrentPage(page)
Sets the current page of the document.
setColor(color)
Sets the color for text and shapes.
getPDF()
Returns the current PDF document instance.
generatePDFURL()
Generates a URL for downloading the PDF document.
drawText(text, options)
Draws text on the current page.
drawCircleText(x, y, text, options)
Draws a circle with text centered inside.
drawTable(header, data, options)
Draws a table with the specified header and data.
addImage(x, y, base64Image, imageScale)
Adds an image to the PDF document.
drawWatermark(text, size)
Draws a watermark on each page of the document.
If you find a bug or have a feature request, feel free to open an issue or submit a pull request. Contributions are welcome!
This project is licensed under the MIT License.
FAQs
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, all
We found that pdf-lib-extended demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.