Skip to content

pdfbolt/playwright-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎭 Playwright PDF Examples

Welcome to the Playwright PDF Examples repository!

Here, you'll find practical examples of how to generate high-quality PDFs using Playwright.


✨ First Example: Invoice Generator

Playwright Badge Node.js Badge EJS Badge HTML5 Badge

  • The Invoice Generator demonstrates how to create a fully functional, high-quality invoice PDF using Playwright, Node.js, and EJS templates.
  • EJS templates are essentially HTML files with placeholders for dynamic content. By combining these technologies, you can generate dynamic, customizable PDFs from HTML templates with ease.

🎨 Example Output

Here’s a sneak peek at the invoice you’ll generate:

Invoice example generated using Playwright

📂 Repository Structure

invoice-generator/
├── data/                     // Directory for data files
│   └── invoice-data.json     // JSON file for invoice data
├── templates/                // Directory for HTML templates
│   └── invoice.ejs           // EJS template for the invoice
├── generate-invoice.js       // Main script for generating PDFs
└── package.json              // Project configuration file

🚀 How to Run the Example

1. Clone the Repository

git clone https://github.com/pdfbolt/playwright-examples.git

2. Navigate to the Invoice Generator Directory

cd invoice-generator

3. Install Dependencies

Ensure you have Node.js installed, then install the necessary dependencies:

npm install

4. Run the Invoice Generator Script

node generate-invoice.js

5. View the Output

After running the script, the PDF will be saved in invoice-generator directory as:

invoice-<timestamp>.pdf

Good Luck and Happy PDFing! 🚀

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors