New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

adonis-pdf

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonis-pdf - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

2

package.json
{
"name": "adonis-pdf",
"version": "0.0.8",
"version": "0.0.9",
"description": "Create PDF files within Adonis using pdfmake",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,6 +18,12 @@ # adonis-pdf

## Usage
`PDF.create()` accepts two parameters:
* `definition`: Object representing the PDF content/styles etc
* `stream`: A Readable or Writeable Stream the PDF will be piped to
## Example
```js
'use strict'
const Pdf = use('Pdf')
const PDF = use('PDF')

@@ -27,13 +33,19 @@ class MyController {

async generatePdf ({ response }) {
const pdf = new PDF({
// custom config (this will override config/pdf.js )
})
const doc = Pdf.create({
const definition = {
content: [
{ text: 'test' }
]
})
{
text: 'test',
style: 'header'
}
],
styles: {
header: {
fontSize: 22,
bold: true
}
}
}
doc.pipe(response.response)
doc.end()
PDF.create(definition, response.response)

@@ -40,0 +52,0 @@ return response

@@ -45,3 +45,3 @@ 'use strict'

if (typeof content === 'object') {
this.document = this.printer.createPdfKitDocument(content)
this.document = this.printer.createPdfKitDocument({ content: content })
this.document.pipe(stream)

@@ -48,0 +48,0 @@ this.document.end()

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc