survey-pdf
Version:
survey.pdf.js is a SurveyJS PDF Library. It is a easy way to export SurveyJS surveys to PDF. It uses JSON for survey metadata.
36 lines (32 loc) • 1.49 kB
JavaScript
/*!
* surveyjs - SurveyJS PDF library v2.3.11
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
import { P as PDFFormFillerBase, _ as __awaiter } from './pdf-form-filler-shared.mjs';
export { b as PDFJSAdapter, a 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))
*/
class PDFFormFiller extends PDFFormFillerBase {
saveToFile(pdfBytes, fileName) {
return __awaiter(this, void 0, void 0, function* () {
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