survey-pdf
Version:
Renders JSON-driven SurveyJS forms and their responses as PDF documents in the browser or Node.js: fillable interactive PDF forms (AcroForm) or static printouts.
35 lines (31 loc) • 1.39 kB
JavaScript
/*!
* surveyjs - SurveyJS PDF library v3.0.2
* Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
import { P as PDFFormFillerBase } from './pdf-form-filler-shared.mjs';
export { a as PDFJSAdapter, b as PDFLibAdapter } from './pdf-form-filler-shared.mjs';
/**
* A plugin that enables you to fill interactive fields in existing PDF forms.
*
* This plugin requires a third-party library, such as [`pdf-lib`](https://pdf-lib.js.org/) or [PDF.js](https://mozilla.github.io/pdf.js/):
*
* [View pdf-lib Demo](https://surveyjs.io/pdf-generator/examples/map-survey-responses-to-pdf-fields-using-pdflib/ (linkStyle))
*
* [View PDF.js Demo](https://surveyjs.io/pdf-generator/examples/fill-in-pdf-form-fields-with-dynamic-survey-data-using-pdfjs/ (linkStyle))
* @since 2.0.9
*/
class PDFFormFiller extends PDFFormFillerBase {
async saveToFile(pdfBytes, fileName) {
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(link.href);
}
}
export { PDFFormFiller };
//# sourceMappingURL=pdf-form-filler.mjs.map