Releases: pdfstudio-dev/pdfstudio
v0.3.2 - Table Header Positioning Bug Fix
🐛 Bug Fixes
Table Header Positioning (Critical Bug Fix)
Fixed a critical bug where table headers were rendering below data rows instead of above them.
Root Cause:
Incorrect handling of PDF coordinate system where Y-axis grows upward from the bottom of the page.
Solution:
Comprehensive coordinate system overhaul in Table.ts affecting 8 critical locations:
- Changed
rect(x, y, width, height)torect(x, y, width, -height)for downward drawing (3 locations) - Inverted
calculateTextY()logic to properly position text in downward-drawing cells - Fixed header border Y position from
y + heighttoy - height - Fixed row border Y position from
y + heighttoy - height - Corrected vertical border drawing direction
- Rewrote outer borders logic to properly handle top/bottom/left/right borders
✅ Testing
- Added comprehensive table test suite with 39 new unit tests
- Total test count increased from 229 to 268 tests
- All tests passing (268/268) ✓
- Coverage includes: basic rendering, column handling, styling, alignment, borders, page breaks, edge cases
- Browser compatibility verified with
test-tables-browser.html
📦 Installation
npm install @pdfstudio/pdfstudio@0.3.2
🔗 Full Changelog
Full Changelog: https://github.com/pdfstudio-dev/pdfstudio/compare/v0.3.1...v0.3.2
### Commit SHA
e130808ee72bd87140994cbdd7bb90e377521c5a
### Files changed
- `package.json`
- `CHANGELOG.md`
- `README.md`
- `src/tables/Table.ts`
- `tests/tables/Table.test.ts` (new)v0.3.1 - Text Layout Features: Ellipsis and Paragraph Gap
🎨 PDFStudio v0.3.1 - Advanced Text Layout Features
Two powerful new text formatting features for professional PDF layouts.
✨ New Features
1. Ellipsis - Text Truncation
Automatically truncate text that exceeds available height with customizable ellipsis.
// Default ellipsis "..."
doc.text(longText, {
x: 50, y: 500,
width: 200,
height: 60,
ellipsis: true
})
// Custom ellipsis
doc.text(article.preview, {
x: 50, y: 500,
width: 400,
height: 80,
ellipsis: '...[Read More]'
})
Features:
- ✅ Efficient O(log n) binary search algorithm
- ✅ Support for custom ellipsis strings
- ✅ Perfect for previews, summaries, and fixed-size boxes
- ✅ Works with multi-column layouts and text alignment
2. Paragraph Gap - Precise Spacing
Add exact spacing after paragraphs for professional typography.
doc.text('Section Heading', {
x: 50,
y: 700,
fontSize: 16,
font: 'Helvetica-Bold',
paragraphGap: 20 // 20pt space after
})
doc.text('Body paragraph', {
x: 50,
y: doc.getCurrentY(),
width: 500,
fontSize: 11,
paragraphGap: 12 // 12pt space after
})
Common values:
- 6-8pt: Tight spacing (lists, dense content)
- 10-12pt: Normal spacing (body paragraphs)
- 15-20pt: Section breaks (headings to content)
📦 Installation
npm install @pdfstudio/pdfstudio@0.3.1
🧪 Testing
- ✅ 229 tests passing (100% success rate)
- ✅ 21 integration tests for ellipsis and paragraphGap
- ✅ 26 unit tests for TextMeasure truncation
📚 Examples
New example files demonstrating features:
- examples/test-ellipsis-paragraphgap.ts - Visual test suite (5 tests)
- examples/example-product-catalog.ts - Product cards with truncated descriptions
- examples/example-article-preview.ts - Newsletter with article previews
- examples/example-documentation.ts - Professional documentation layout
Browser demos:
- 3 interactive demos in examples/browser/index.html
🔧 Implementation Details
Core changes:
- src/core/PDFWriter.ts - Ellipsis and paragraphGap implementation
- src/text/TextMeasure.ts - Binary search truncation algorithm with O(log n) complexity
- Full TypeScript type definitions for new options
Browser bundle:
- Size: 604.4kb (minified)
- Debug version: 1.3mb
📖 Documentation
- README.md - Updated with feature examples
- CHANGELOG.md - Complete v0.3.1 changelog
- BROWSER.md - Browser compatibility guide
🔗 Links
- 📦 https://www.npmjs.com/package/@pdfstudio/pdfstudio
- 🌐 https://pdfstudio.io
- 📚 README.md
🙏 Contributors
Thanks to all contributors who made this release possible!v0.3.0 - Unicode Substitution
Release v0.3.0 - Unicode Substitution & PDF UI Studio Branding
Major improvements for PDFStudio v0.3.0 featuring unicode support and complete rebranding with PDF UI Studio.
✨ New Features
Unicode Substitution
- NEW:
unicode-substitutionutility with 60+ character mappings - NEW: Automatic conversion of unsupported Unicode to WinAnsi encoding
- NEW: Integration in
PDFWriter.escapePDFString()for seamless compatibility - NEW: Export functions:
substituteUnicode(),detectUnsupportedChars(),getSubstitution()
Text Flow Control (v0.3.0)
moveDown()- Move cursor downmoveUp()- Move cursor upgetCurrentY()- Get current Y positiongetCurrentX()- Get current X position
Graphics & Layout
roundedRect()- Draw rounded rectangles- Multi-column text layout with
columnsandcolumnGapoptions - Text rotation with
rotationoption - Bulleted/numbered lists with 8 bullet styles
Navigation
- Named destinations with
destinationoption - Internal navigation with
goTooption
🎨 PDF UI Studio Integration
PDFStudio is now officially sponsored by PDF UI Studio - a visual PDF editor platform.
Branding Updates
- ✅ All examples updated with PDF UI Studio data and branding
- ✅ Color scheme: Purple (#7C3AED, #6D28D9, #5B21B6)
- ✅ Browser demo with promotional banner
- ✅ README sponsorship section
- ✅ Contact email: pdfstudio@ideas2code.dev
- ✅ URLs: pdfuistudio.io and github.com/pdfstudio-dev/pdfstudio
Example Enhancements
- Charts showcase realistic platform growth metrics (4,088+ users, +68% growth)
- Tables display pricing tiers (Free, Professional $7/mo, Lifetime $100)
- Real-world examples rebranded: Invoice, Report, Certificate, Flyer, Resume
- Browser demo features John Warnock tribute (PDF creator)
🧹 Repository Improvements
- Add
examples-output/and*.pdfto.gitignore - Remove 82 generated PDF files from version control
- Add
.DS_Storeand OS-specific files to gitignore - Update
.npmignorefor cleaner npm package - Update author email in
package.json
📦 Installation
npm install @pdfstudio/pdfstudio
---
🚀 Quick Start
import { PDFDocument } from '@pdfstudio/pdfstudio'
const doc = new PDFDocument()
// Unicode now works automatically!
doc.text('Special chars: • → ≠ ∞', 50, 750)
// New rounded rectangles
doc.roundedRect(50, 600, 200, 100, 10)
// Multi-column layout
doc.text('Long text...', {
x: 50, y: 500,
width: 500,
columns: 2,
columnGap: 20
})
doc.save('output.pdf')
---
📚 Documentation
- GitHub: https://github.com/pdfstudio-dev/pdfstudio
- npm: https://www.npmjs.com/package/@pdfstudio/pdfstudio
- PDF UI Studio: https://pdfuistudio.io
---
💜 Sponsor
This release is made possible by https://pdfuistudio.io - Design PDFs visually with drag & drop and export
production-ready JavaScript code instantly.
✨ AI-Powered Templates • 🎯 Real-Time Preview • 💻 Export Clean Code • 🚀 Free to Start
https://pdfuistudio.io/?ref=pdfstudio-release
---
🙏 Acknowledgments
Special tribute to John Warnock (1940-2023), co-founder of Adobe and creator of the PDF format. This release
honors his legacy of innovation in document technology.
---
📊 Stats
- 112 files changed
- 1,801 insertions (+)
- 2,645 deletions (-)
- 82 PDFs removed from version control
- 3 new files created
---
🔗 Links
- https://github.com/pdfstudio-dev/pdfstudio/blob/main/CHANGELOG.md
- https://github.com/pdfstudio-dev/pdfstudio/issues
- https://pdfuistudio.io
---v0.2.0 - Browser Support
🎉 Major New Feature: Browser Support
PDFStudio now works natively in web browsers! Generate PDFs client-side with 100% API parity to the Node.js version.
✨ What's New
🌐 Browser Compatibility
- Complete Platform Abstraction - Seamless Node.js/Browser compatibility via adapter pattern
- 100% API Parity - Identical API across Node.js and browsers
- All Features Supported - Charts, tables, QR codes, encryption, forms, annotations, etc.
- Zero Server Dependencies - Everything runs client-side
- Modern Browser Support - Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
- Small Bundle Size - ~600KB minified (including all features)
- TypeScript Support - Full type definitions for browser environment
🔐 Browser-Specific Implementations
- Pure JavaScript MD5 - Custom MD5 implementation for PDF encryption in browsers
- Web Crypto API Integration - Secure random number generation
- Canvas-Based Image Processing - No dependencies for image handling
- File System Abstraction -
BrowserFileSystemusing Fetch API, FileReader, and Blob - Image Processor Abstraction -
BrowserImageProcessorusing Canvas/OffscreenCanvas - Buffer Polyfill - Full Buffer support via npm buffer package
- Automatic Download - Trigger file downloads or get as Blob for uploading
📦 Build System
- Dual Build Target - Separate builds for Node.js (CommonJS) and Browser (IIFE)
- esbuild Integration - Fast, optimized browser bundling
- Automatic Tree-Shaking - Remove unused code
- Smart Polyfills - Only include necessary polyfills (Buffer, crypto)
- Module Replacement - Replace Node modules (fs, sharp) with browser equivalents
- Source Maps - Debug support for both minified and debug builds
📚 Installation
Node.js
npm install @pdfstudio/pdfstudio
Browser (Standalone)
<script src="https://unpkg.com/@pdfstudio/pdfstudio@0.2.0/dist/pdfstudio.standalone.js"></script>
<script>
const doc = new PDFStudio.PDFDocument();
doc.text('Hello from Browser!', 100, 700, 24);
await doc.save('output.pdf'); // Downloads automatically
</script>
Browser (Bundlers - Vite, Webpack, etc.)
import { PDFDocument } from '@pdfstudio/pdfstudio';
const doc = new PDFDocument();
doc.text('Hello!', 100, 700, 24);
await doc.save('output.pdf');
🔄 Breaking Changes
Methods involving I/O are now async:
- doc.save() → await doc.save()
- doc.toBuffer() → await doc.toBuffer()
- doc.registerFont() → await doc.registerFont()
- doc.image() → await doc.image()
Migration example:
// Before (v0.1.x)
doc.save('output.pdf');
// After (v0.2.x)
await doc.save('output.pdf');
See https://github.com/pdfstudio-dev/pdfstudio/blob/main/BROWSER_MIGRATION.md for complete migration guide.
🐛 Fixed
- Table Text Alignment - Corrected vertical centering in table cells with proper baseline calculations
- File Attachments - Fixed crash when attachment name is undefined
- Font Selection - Fixed font parameter being ignored in simple text() calls
- Crypto Compatibility - MD5 hashing now works in browsers (previously unsupported)
🎨 Examples & Demos
- Invoice Generator - Real-world invoice with tables and totals
- Business Report - Multi-page report with KPIs and charts
- Certificate - Professional certificate with vector graphics
- QR Code Examples - Email, URL, WiFi, vCard, and more
- Form Examples - Interactive forms with encryption
- Chart Gallery - All 7 chart types with styling options
80+ interactive browser examples in examples/browser/index.html
📐 Platform Differences
| Feature | Node.js | Browser |
|------------------|------------------|-----------------------------|
| File I/O | fs module | fetch() / FileReader / Blob |
| Image Processing | sharp (optional) | Canvas API |
| Font Loading | File paths | URLs or File objects |
| File Save | Disk write | Download trigger |
| Buffer | Native | Polyfilled |
| Crypto | Node crypto | Web Crypto + MD5 polyfill |
📦 Dependencies
- Added: buffer@^6.0.3 - Buffer polyfill for browsers
- Added: esbuild@^0.19.0 - Browser bundle builder
- Changed: sharp@^0.34.5 → optionalDependencies (not needed in browser)
⚡ Performance
- Optimized Bundle - Tree-shaking reduces unused code
- Lazy Loading - Platform adapters loaded on demand
- Efficient Polyfills - Minimal overhead for browser environment
🧪 Testing
- All 180 Tests Pass - Full compatibility maintained
- Cross-Platform Testing - Verified on Node.js and browsers
- Browser Examples - Comprehensive manual testing suite
📚 Documentation
- https://github.com/pdfstudio-dev/pdfstudio/blob/main/BROWSER.md - Complete browser usage guide (406 lines)
- https://github.com/pdfstudio-dev/pdfstudio/blob/main/BROWSER_MIGRATION.md - Migration guide for existing users (211 lines)
- Updated README - Expanded browser support section with examples
📦 npm Package
Published to npm: https://www.npmjs.com/package/@pdfstudio/pdfstudio
Full changelog: https://github.com/pdfstudio-dev/pdfstudio/blob/main/CHANGELOG.md#020---2025-01-21v0.1.1 - Initial Release
🎉 Initial Release
First stable release of PDFStudio - A modern PDF generation library for Node.js with advanced charts and vector graphics.
✨ Key Features
📊 Charts and Visualizations
- 7 Chart Types - Bar, Grouped Bar, Stacked Bar, Line, Multi-Line, Pie, and Donut charts
- Chart Gradients - Linear and radial gradient effects
- Chart Legends - 6 positions with automatic formatting
- Customizable Grids - Full control over grid and axis styling
📄 Advanced Documents
- Multi-Page Support - Unlimited pages with navigation
- 14+ Page Sizes - Letter, Legal, A4, A3, Tabloid, and more
- Automatic Page Numbering - 6 positions with customizable formats
- Advanced Tables - Auto page breaks with header repetition
✍️ Rich Text & Graphics
- Custom Fonts - TrueType/OpenType support (.ttf, .otf, .ttc)
- Word Wrap - Smart line breaking without cutting words
- Vector Graphics - Bezier curves, transformations, clipping paths
- Text Decorations - Underline, strikethrough, clickable links
🔒 Security & Forms
- Encryption - 40/128/256-bit AES encryption
- Password Protection - User and owner passwords
- Interactive Forms - Text fields, checkboxes, radio buttons, dropdowns
- Digital Signatures - Signature field support
🎨 Advanced Features
- QR Codes - Generate QR codes with customizable options
- Watermarks - Text and image watermarks
- Annotations - Comments, highlights, file attachments
- Layers (OCG) - Optional Content Groups
💻 Developer Experience
- TypeScript - Full type definitions included
- Fluent API - Method chaining for clean code
- 180 Unit Tests - 100% pass rate
- Minimal Dependencies - Only 4 runtime dependencies
- Comprehensive Docs - 1800+ lines of documentation
📦 Installation
npm install @pdfstudio/pdfstudio
🚀 Quick Start
import { PDFDocument } from '@pdfstudio/pdfstudio';
const doc = new PDFDocument();
doc.text('Hello PDFStudio!', 100, 700, 24);
doc.save('output.pdf');
📚 Documentation
- README.md - Complete documentation with examples
- 20+ Code Examples - Working examples for all features
- Type Definitions - Full TypeScript support
🧪 Testing
- 180 tests across 9 test suites
- 100% pass rate
- Fast execution (~0.75 seconds)
📦 npm Package
Published to npm: https://www.npmjs.com/package/@pdfstudio/pdfstudio
Full feature list: https://github.com/pdfstudio-dev/pdfstudio/blob/main/CHANGELOG.md