A high-quality, configurable HTML to PDF converter with perfect font rendering and styling support. Originally created for generating professional resumes when applying for jobs, as most online converters were either paid, limited, didn't support Persian fonts, or malformed the output.
See it in action! Watch how Flawless PDF Generator converts HTML to perfect PDFs
🎥 Watch Demo Video
genrator_showcase.mp4
While applying for jobs, I needed to convert my HTML resume to PDF format. However, I faced several issues with existing solutions:
- Paid Services - Most quality converters require subscriptions
- Limited Free Options - Free tools have severe restrictions (watermarks, page limits, etc.)
- Poor Persian Font Support - Many converters don't handle Persian/Farsi fonts properly
- Malformed Output - CSS gradients, web fonts, and RTL text often break
This project solves all these problems with a free, open-source solution that delivers flawless PDF output.
- High-Quality PDF Generation - Uses Puppeteer (Headless Chrome) for perfect rendering
- Perfect Font Support - Handles web fonts including Persian fonts (Vazirmatn, IRANSans, etc.)
- No Limitations - Completely free, no watermarks, no page restrictions
- Preserves Styling - Gradients, backgrounds, custom fonts, and modern CSS features
- RTL Support - Perfect right-to-left text rendering for Persian, Arabic, Hebrew
- Fully Configurable - Environment-based settings for all PDF options
- PDF Metadata - Embed title, author, subject, and keywords in PDFs
- Single Page Mode - Automatically scale content to fit on exactly one page
- ATS-Friendly Mode - Optimize for Applicant Tracking Systems
- Batch Processing - Convert multiple HTML files at once
- Bilingual Templates - Includes both English and Persian resume examples
- Cross-Platform - Works on Windows, macOS, and Linux
- Node.js (v14 or higher) - Download here
- npm (comes with Node.js)
git clone https://github.com/yourusername/flawless-pdf-generator.git
cd flawless-pdf-generatornpm installThis will install:
puppeteer- For high-quality PDF generationdotenv- For environment configuration
Edit the .env file to customize your settings:
# The .env file is already included with default settings
# Edit it to match your preferencesPlace your HTML files in the input/ directory:
# The project includes two resume examples already in input/
input/modern_resume_fa.html # Persian resume example
input/modern_resume.html # English resume example
# Add your own HTML files to the input/ folderRun the conversion:
node main.jsThe script will automatically:
- Convert all HTML files from the
input/folder - Save PDFs to the
output/folder with the same filenames - Open the output directory when done (if AUTO_OPEN_PDF=true)
All settings are managed in the .env file:
INPUT_DIR=input
OUTPUT_DIR=output- INPUT_DIR: Place all HTML files here
- OUTPUT_DIR: Generated PDFs will be saved here
The converter processes all HTML files in the input directory automatically.
PDF_FORMAT=A4Available formats and sizes:
| Format | Size (Imperial) | Size (Metric) | Common Use |
|---|---|---|---|
| Letter | 8.5in × 11in | 21.59cm × 27.94cm | US standard |
| Legal | 8.5in × 14in | 21.59cm × 35.56cm | US legal documents |
| Tabloid | 11in × 17in | 27.94cm × 43.18cm | Newspapers, posters |
| Ledger | 17in × 11in | 43.18cm × 27.94cm | Accounting, spreadsheets |
| A0 | 33.11in × 46.81in | 84.1cm × 118.9cm | Posters, technical drawings |
| A1 | 23.39in × 33.11in | 59.4cm × 84.1cm | Flip charts, posters |
| A2 | 16.54in × 23.39in | 42cm × 59.4cm | Drawings, diagrams |
| A3 | 11.69in × 16.54in | 29.7cm × 42cm | Large documents |
| A4 | 8.27in × 11.69in | 21cm × 29.7cm | International standard |
| A5 | 5.83in × 8.27in | 14.8cm × 21cm | Booklets, notepads |
| A6 | 4.13in × 5.83in | 10.5cm × 14.8cm | Postcards, small notes |
MARGIN_TOP=0
MARGIN_RIGHT=0
MARGIN_BOTTOM=0
MARGIN_LEFT=0Set margins in millimeters. Useful for printing requirements.
PRINT_BACKGROUND=trueSet to false to disable background colors and gradients (saves ink when printing).
FONT_WAIT_TIME=2000Time in milliseconds to wait for web fonts to load:
- Fast connection:
2000(2 seconds) - Slow connection:
5000(5 seconds) - Very slow:
10000(10 seconds)
PAGE_TIMEOUT=30000Maximum time to wait for page to load (in milliseconds).
AUTO_OPEN_PDF=trueAutomatically open the PDF after generation. Set to false to disable.
Add professional metadata to your PDFs for better searchability and organization:
PDF_TITLE=John Doe - Software Engineer Resume
PDF_AUTHOR=John Doe
PDF_SUBJECT=Professional Resume - Software Engineer
PDF_KEYWORDS=resume, software engineer, backend developer, Node.js
PDF_CREATOR=Flawless PDF GeneratorThis metadata is embedded in the PDF and visible in PDF readers' document properties.
Create a single scrollable page with all content:
SINGLE_PAGE_MODE=trueWhen enabled:
- Creates ONE tall page containing all your content
- Users can scroll down to see everything (like a webpage)
- No content is cut off or split across multiple pages
- Perfect for online viewing and uploading to job sites
Perfect For:
- 📱 Online portfolios - LinkedIn, job sites, personal websites
- 🌐 Digital sharing - Easy to view in browsers and PDF readers
- 📊 Long resumes - Keeps everything on one scrollable page
- ✅ No compression - Full-size readable text, just scroll to see more
Note: This creates a scrollable single page (like your proof of concept), not a compressed/shrunk page. The PDF will be taller than standard formats but everything stays readable.
Optimize PDFs for Applicant Tracking Systems (ATS):
ATS_FRIENDLY_MODE=trueWhen enabled:
- Disables background colors and gradients
- Uses standard Arial font as fallback
- Removes shadows and complex styling
- Ensures text is fully selectable and searchable
- Improves compatibility with ATS parsing engines
Recommended for job applications where resumes are processed by automated systems.
- Drop HTML files into the
input/folder - Run the script (run
node main.js) - Get PDFs in the
output/folder with perfect styling
The script automatically processes all HTML files in the input directory and converts them to PDFs with the same filename.
- Resumes/CVs - Convert HTML resumes to professional PDFs
- Reports - Generate styled PDF reports from HTML
- Documents - Any HTML document that needs PDF conversion
- Multilingual Content - Perfect for Persian, Arabic, Hebrew, and other RTL languages
- Web Pages - Archive web pages as PDFs with perfect styling
- Batch Conversion - Convert multiple HTML files at once
| Feature | This Project | Online Converters |
|---|---|---|
| Cost | Free | Mostly paid |
| Persian Fonts | Perfect support | Often broken |
| Web Fonts | Full support | Limited/broken |
| CSS Gradients | Perfect | Often malformed |
| RTL Text | Native support | Often broken |
| Page Limits | Unlimited | Usually limited |
| Watermarks | None | Common in free tiers |
| Privacy | 100% local | Upload to servers |
| Customization | Fully configurable | Fixed options |
| Metadata | Full support | Often missing |
| Single Page | Auto-scaling | Manual only |
| ATS Mode | Built-in | Not available |
- Open
modern_resume_fa.html(Persian) ormodern_resume.html(English) - Edit your information, experience, skills, etc.
- Save the file
- Run the generator script
Skill bars use a 5-level system:
<div class="skill-bar">
<div class="skill-level filled"></div> <!-- Filled -->
<div class="skill-level filled"></div>
<div class="skill-level filled"></div>
<div class="skill-level filled"></div>
<div class="skill-level empty"></div> <!-- Empty -->
</div>Change filled to empty to adjust proficiency levels.
Modify the gradient in the CSS:
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);Increase FONT_WAIT_TIME in .env:
FONT_WAIT_TIME=5000Increase PAGE_TIMEOUT in .env:
PAGE_TIMEOUT=60000- Check that your HTML is valid
- Ensure the page format matches your content
- Try adjusting margins if content is cut off
If Puppeteer fails to install:
npm install --save puppeteer --unsafe-perm=true --allow-rootflawless-pdf-generator/
├── input/ # Put your HTML files here
│ ├── modern_resume_fa.html # Persian resume example
│ └── modern_resume.html # English resume example
├── output/ # Generated PDFs appear here
├── node_modules/ # Dependencies (created after npm install)
├── .env # Configuration file
├── .env.example # Example configuration template
├── .gitignore # Git ignore rules
├── package.json # Node.js dependencies
├── package-lock.json # Dependency lock file
├── main.js # Main PDF generator script
└── README.md # This file
- Node.js - JavaScript runtime
- Puppeteer - Headless Chrome for PDF generation
- dotenv - Environment configuration
- HTML5 & CSS3 - Modern web standards
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- Persian font in examples: Vazirmatn by Saber Rastikerdar
- Built out of necessity during job applications
- Inspired by the frustration with paid and limited online converters
Free, unlimited, high-quality HTML to PDF conversion! 🚀