survey-pdf 2.0.8 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm/pdf-form-filler-shared.mjs +191 -0
- package/fesm/pdf-form-filler-shared.mjs.map +1 -0
- package/fesm/pdf-form-filler.mjs +26 -0
- package/fesm/pdf-form-filler.mjs.map +1 -0
- package/fesm/pdf-form-filler.node.mjs +27 -0
- package/fesm/pdf-form-filler.node.mjs.map +1 -0
- package/fesm/survey.pdf.fonts.mjs +1 -1
- package/fesm/survey.pdf.mjs +2 -2
- package/fesm/survey.pdf.mjs.map +1 -1
- package/package.json +10 -2
- package/pdf-form-filler.js +582 -0
- package/pdf-form-filler.js.map +1 -0
- package/pdf-form-filler.min.js +2 -0
- package/pdf-form-filler.min.js.LICENSE.txt +5 -0
- package/pdf-form-filler.node.js +605 -0
- package/pdf-form-filler.node.js.map +1 -0
- package/pdf-form-filler.node.min.js +2 -0
- package/pdf-form-filler.node.min.js.LICENSE.txt +5 -0
- package/survey.pdf.fonts.js +1 -1
- package/survey.pdf.fonts.min.js.LICENSE.txt +1 -1
- package/survey.pdf.js +2 -2
- package/survey.pdf.js.map +1 -1
- package/survey.pdf.min.js +1 -1
- package/survey.pdf.min.js.LICENSE.txt +1 -1
- package/typings/entries/forms-node.d.ts +3 -0
- package/typings/entries/forms.d.ts +3 -0
- package/typings/pdf_forms/adapters/adapter.d.ts +3 -0
- package/typings/pdf_forms/adapters/pdf-lib.d.ts +6 -0
- package/typings/pdf_forms/adapters/pdfjs.d.ts +6 -0
- package/typings/pdf_forms/forms-base.d.ts +32 -0
- package/typings/pdf_forms/forms-node.d.ts +4 -0
- package/typings/pdf_forms/forms.d.ts +4 -0
- package/typings/pdf_forms/map.d.ts +7 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see pdf-form-filler.node.min.js.LICENSE.txt */
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("fs")):"function"==typeof define&&define.amd?define("PDFFormFiller",["fs"],e):"object"==typeof exports?exports.PDFFormFiller=e(require("fs")):t.PDFFormFiller=e(t.fs)}(this,(t=>(()=>{"use strict";var e={947:e=>{e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{PDFFormFiller:()=>l,PDFJSAdapter:()=>d,PDFLibAdapter:()=>p});var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)};function a(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((n=n.apply(t,e||[])).next())}))}function u(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}const s=function(){function t(t){this.map=t,this.res={}}return t.prototype.mapDataRecursive=function(t,e){var r=this;if(null!=t)return"object"!=typeof t?Array.isArray(e)?void e.forEach((function(e){r.mapDataRecursive(t,e)})):void("object"!=typeof e?this.res[e]=t:this.res[e[t].field]=e[t].value):void(Array.isArray(t)?t.forEach((function(t,n){r.mapDataRecursive(t,Array.isArray(e)?e[n]:e)})):Object.keys(t).forEach((function(n){r.mapDataRecursive(t[n],e[n])})))},t.prototype.mapData=function(t){return this.res={},this.mapDataRecursive(t,this.map),this.res},t}();var c=function(){function t(t){void 0===t&&(t=null),t&&(this.data=t.data,this.fieldMap=t.fieldMap,this.pdfTemplate=t.pdfTemplate,this.pdfLibraryAdapter=t.pdfLibraryAdapter)}return t.prototype.getPDFBytes=function(){return a(this,void 0,void 0,(function(){var t,e;return u(this,(function(r){switch(r.label){case 0:return t=new s(this.fieldMap),e=t.mapData(this.data),[4,this.pdfLibraryAdapter.fillForm(this.pdfTemplate,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.raw=function(t){return a(this,void 0,void 0,(function(){var e,r;return u(this,(function(n){switch(n.label){case 0:return[4,this.getPDFBytes()];case 1:return e=n.sent(),t?"dataurlstring"==t?[2,"data:text/plain;base64,"+btoa(e)]:(r=new Blob([e],{type:"application/pdf"}),"blob"==t?[2,r]:"bloburl"==t?[2,URL.createObjectURL(r)]:[2,e]):[2,e]}}))}))},t.prototype.save=function(){return a(this,arguments,void 0,(function(t){var e;return void 0===t&&(t="survey_result.pdf"),u(this,(function(r){switch(r.label){case 0:return[4,this.getPDFBytes()];case 1:return e=r.sent(),[4,this.saveToFile(e,t)];case 2:return r.sent(),[2]}}))}))},t}(),f=n(947),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.saveToFile=function(t,e){return a(this,void 0,void 0,(function(){return u(this,(function(r){return[2,new Promise((function(r,n){(0,f.writeFile)(e,t,(function(t){t?n(t):r()}))}))]}))}))},e}(c),p=function(){function t(t){this.pdfLibrary=t}return t.prototype.fillForm=function(t,e){return a(this,void 0,void 0,(function(){var r,n,o,i,a,s,c;return u(this,(function(u){switch(u.label){case 0:return r=this.pdfLibrary,n=r.PDFDocument,o=r.PDFTextField,i=r.PDFCheckBox,a=r.PDFRadioGroup,s=r.PDFDropdown,[4,n.load(t)];case 1:return c=u.sent(),c.getForm().getFields().forEach((function(t){var r=t.getName(),n=e[r];null!=n&&(t instanceof o?t.setText(n):t instanceof i?n?t.check():t.uncheck():(t instanceof a||t instanceof s)&&t.select(n.toString()))})),[4,c.save()];case 2:return[2,u.sent()]}}))}))},t}(),d=function(){function t(t){this.pdfLibrary=t}return t.prototype.fillForm=function(t,e){return a(this,void 0,void 0,(function(){var r;return u(this,(function(n){switch(n.label){case 0:return[4,this.pdfLibrary.getDocument(t).promise];case 1:return[4,(r=n.sent()).getPage(1)];case 2:return[4,n.sent().getAnnotations()];case 3:return n.sent().forEach((function(t){if(null!=t.fieldType){var n=e[t.fieldName];if(n){if(t.radioButton&&t.buttonValue!=n)return;r.annotationStorage.setValue(t.id,{value:n})}}})),[4,r.saveDocument()];case 4:return[2,n.sent()]}}))}))},t}();return o})()));
|
package/survey.pdf.fonts.js
CHANGED
package/survey.pdf.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS PDF library v2.0.
|
|
2
|
+
* surveyjs - SurveyJS PDF library v2.0.9
|
|
3
3
|
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -1561,7 +1561,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1561
1561
|
|
|
1562
1562
|
|
|
1563
1563
|
|
|
1564
|
-
(0,survey_core__WEBPACK_IMPORTED_MODULE_51__.checkLibraryVersion)("".concat("2.0.
|
|
1564
|
+
(0,survey_core__WEBPACK_IMPORTED_MODULE_51__.checkLibraryVersion)("".concat("2.0.9"), 'survey-pdf');
|
|
1565
1565
|
|
|
1566
1566
|
|
|
1567
1567
|
/***/ }),
|