I built vue-pdf-export - a Vue 3 PDF Export library for real-world browser apps
Hey everyone ๐ I recently released vue-pdf-export , a Vue 3 + TypeScript library for generating PDFs directly in the browser. I built it after repeatedly needing the same PDF features across different Vue projects and wanting one reusable solution instead of rebuilding the same logic each time. What it supports Some of the main features include: Canvas and selectable-text PDF rendering Automaticโฆ
A Vue 3 TypeScript library called vue-pdf-export has been released by the author. The library enables the generation of PDFs directly in the browser for Vue projects. The creator developed it due to the need for consistent PDF features across different projects, aiming to create a reusable solution rather than reinventing the same codebase each time.
Key features of the library include:
- Canvas and selectable-text PDF rendering
- Automatic and manual pagination
- Preview, download, and browser print capabilities
- Headers and footers
- Watermarks and page targeting
- Clickable PDF links
- Password protection and permissions
- PDF metadata and compression
- Large-document rendering
- Blob, ArrayBuffer, Base64, and PDF data URL outputs
- Data-pdf-ignore for excluding UI elements from exports
- Export-only page and body styling
- Nuxt 3 and Nuxt 4 SSR-safe package imports
- Compatibility with npm, pnpm, Yarn, Yarn Plug n Play, and Bun
To install the package, use the command: npm install vue-pdf-export
Basic usage involves importing the library and creating a ref for the Html2Pdf instance. The library provides options for Canvas rendering and selectable-text rendering, catering to both highly visual layouts and text-heavy documents. The generated PDF can be used directly within the application or exported in various formats.
The library is also designed to work seamlessly with Nuxt 3 and Nuxt 4, ensuring that importing it does not crash the SSR. Actual PDF generation occurs in the browser, allowing for client-side rendering when needed.
For live demonstration, visit the playground at https://vue-pdf-export-playground.vercel.app/. The documentation can be found at https://vue-pdf-export-docs.vercel.app/. The package is available on npm at https://www.npmjs.com/package/vue-pdf-export. The author is open to feature requests and feedback from Vue and Nuxt developers, particularly focusing on real-world PDF edge cases, API ergonomics, pagination, large documents, and additional features that would enhance the Vue PDF library.
Written by urgent.news from Dev.to's reporting โ not their text. Machine-written โ may contain errors; check the original before relying on it.