Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
adonis-pdf
Advanced tools
Service provider for building PDFs using pdfmake.
:exclamation: WARNING! This package is heavily in development and is therefore unstable. It may not work correctly or at all. When it is working the way that it needs to I will bump it up to 0.1.0!
npm i adonis-pdf
or yarn add adonis-pdf
'adonis-pdf/providers/PdfProvider'
to the providers
array within start/app.js
Configuration is done through config/pdf.js
. This file should have automatically been copied to your project during installation if you installed it via adonis-cli. If you installed it with npm or Yarn, or the file was not copied across correctly, you may copy the config file from this package or run the following command to create it:
adonis pdf:getconfig
By default all configuration options are null
(i.e. we use the pdfmake defaults) but feel free to override them as per the pdfmake documentation:
Option | Description |
---|---|
fonts | Customise the fonts used in your PDFs; if no fonts are specified this package will automatically load default Roboto fonts |
styles | Custom style dictionaries allowing you to maintain consistent styles across each PDF |
header | Custom header for each page within your PDFs |
footer | Custom footer for each page within your PDFs |
background | Custom background for each page within your PDFs |
page.size | Set the page size to be used |
page.orientation | Set the page orientation |
page.margins | Set up the page margins |
Add const PDF = use('PDF')
to whatever file you wish to use it, then call PDF.create()
. This method accepts two parameters:
content
: Array representing the PDF contentstream
: A Readable or Writeable Stream the PDF will be piped to'use strict'
const PDF = use('PDF')
class MyController {
async generatePdf ({ response }) {
const content = [
{ text: 'test' }
]
PDF.create(content, response.response)
return response
}
}
module.exports = MyController
FAQs
Create PDF files within Adonis using pdfmake
The npm package adonis-pdf receives a total of 10 weekly downloads. As such, adonis-pdf popularity was classified as not popular.
We found that adonis-pdf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.