Introduction
nuxt-pdf
is an open source Nuxt 3 PDF toolkit, that allows you to easily render PDFs application or server side.
- Client side exporting of Vue components to HTML
- Server side rendering of complex PDFs
- Simple encryption of your PDFs, by allowing you to set a password and permissions
- Editable forms inside your PDFs
- Pre-build components to quickly develop your PDF
- documentation, recipes and example code to get you started
Show me the code!
Which method is right for me?
Generating PDFs on the client or through the server fundamentally change how the PDF is compiled and created. We try and ensure that our feature set matches both methods equally, however there are a few method-specific features. These are listed below.
Application Side | Server Side | |
---|---|---|
Features | ||
Convert Vue components to PDFs | ✅ | ❌ |
Add Encryption to your PDFs | ✅ | ✅ |
Define Layouts for your PDFs | ❌ | ✅ |
Use your Tailwind Styles | ✅ | ❌ |
Use pre-build components to create your PDF | ❌ | ✅ |
Define your default PDF options in nuxt.config.ts | ❌ | ✅ |
One factor that this table does not take into account is the reliablity and consistency, that server side generated PDFs will add to your application. Generating a PDF from HTML code, may result in different appearences, based on the browser, screen size and other settings on an individuals PC, limiting the control you have over the finished product. Rendering your PDFs on the server side, will allow you to control the output to a mich higher degree.
Use cases
Application side
- You need to quickly develop your PDF integration
- You already have Vue components developed, that can be reused to generate the PDFs
- You are not concerned about minor layout shifts and differences between browsers
Server side
- You require a higher degree of control over the output
- You are developing complex PDFs that may require large amounts of data, you do not want to directly expose to a users client