const fs = require('fs')
const util = require('util')
const writeFileAsync = util.promisify(fs.writeFile)
async function run() {
const buffer = await pdf.generateFormSubmissionPDF({
formId: 1,
submissionId: 'c63ec3ac-12ab-447c-951c-2815d0e6fc24',
isDraft: false,
includeSubmissionIdInPdf: false,
includeExternalIdInPdf: false,
excludedElementIds: ['1ae6d5f5-eade-411c-b85a-45fe40fe469e'],
})
await writeFileAsync('./submission.pdf', buffer, 'binary')
}
An object containing all parameters to be passed into the function.
const fs = require('fs')
const util = require('util')
const writeFileAsync = util.promisify(fs.writeFile)
async function run() {
const buffer = await pdf.generatePDF({
body: {
html: `
<p>I will be in the middle</p>
`,
},
header: {
html: `
<div style="font-size: 9px; margin: 0 15px; width: 100%; text-align: center;">
I will be at the top of every page
</div>
`,
},
footer: {
html: `
<div style="font-size: 9px; margin: 0 15px; width: 100%; text-align: center;">
I will be at the bottom of every page ({_BLINK_PAGE_NO_}/{_BLINK_PAGES_})
</div>
`,
},
page: {
orientation: 'Portrait',
size: 'A4',
margins: {
top: '15mm',
right: '5mm',
bottom: '15mm',
left: '5mm',
},
},
})
await writeFileAsync('./custom.pdf', buffer, 'binary')
}
const fs = require('fs')
const util = require('util')
const writeFileAsync = util.promisify(fs.writeFile)
async function run() {
const buffer = await pdf.generatePdfFromSubmissionData({
submissionData: {
submission: {
myElementName: 'text 123'
},
definition: {} // form definition
submissionTimestamp: new Date().toISOString(),
formsAppId: 1
},
excludedElementIds: ['1ae6d5f5-eade-411c-b85a-45fe40fe469e'],
usePagesBreaks: true,
excludedCSSClasses: []
includeExternalIdInPdf: false,
})
await writeFileAsync('./submission.pdf', buffer, 'binary')
}
An object containing all parameters to be passed into the function.
Optional
excludedCSSClasses?: string[]Optional
excludedOptional
includeOptional
use
Example