survey-pdf 2.2.0 → 2.2.2
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 +1 -1
- package/fesm/pdf-form-filler-shared.mjs.map +1 -1
- package/fesm/pdf-form-filler.mjs +1 -1
- package/fesm/pdf-form-filler.mjs.map +1 -1
- package/fesm/pdf-form-filler.node.mjs +1 -1
- package/fesm/pdf-form-filler.node.mjs.map +1 -1
- package/fesm/survey.pdf.fonts.mjs +1 -1
- package/fesm/survey.pdf.fonts.mjs.map +1 -1
- package/fesm/survey.pdf.mjs +279 -269
- package/fesm/survey.pdf.mjs.map +1 -1
- package/package.json +2 -2
- package/pdf-form-filler.js +1 -1
- package/pdf-form-filler.min.js +1 -1
- package/pdf-form-filler.min.js.LICENSE.txt +1 -1
- package/pdf-form-filler.node.js +1 -1
- package/pdf-form-filler.node.min.js +1 -1
- package/pdf-form-filler.node.min.js.LICENSE.txt +1 -1
- package/survey.pdf.fonts.js +1 -1
- package/survey.pdf.fonts.min.js +1 -1
- package/survey.pdf.fonts.min.js.LICENSE.txt +1 -1
- package/survey.pdf.js +353 -392
- 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/pdf.d.ts +0 -2
- package/typings/flat_layout/flat_selectbase.d.ts +2 -0
- package/typings/helper_survey.d.ts +3 -7
- package/typings/pdf_render/pdf_textfield.d.ts +13 -10
- package/typings/survey.d.ts +0 -3
- package/typings/pdf_render/pdf_comment.d.ts +0 -8
- package/typings/pdf_render/pdf_textbox.d.ts +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "survey-pdf",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Survey",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"typings": "./typings/entries/pdf.d.ts",
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"survey-core": "2.2.
|
|
22
|
+
"survey-core": "2.2.2"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"jspdf": "^2.3.0 || ^3"
|
package/pdf-form-filler.js
CHANGED
package/pdf-form-filler.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see pdf-form-filler.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("PDFFormFiller",[],e):"object"==typeof exports?exports.PDFFormFiller=e():t.PDFFormFiller=e()}(this,(
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("PDFFormFiller",[],e):"object"==typeof exports?exports.PDFFormFiller=e():t.PDFFormFiller=e()}(this,()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{PDFFormFiller:()=>a,PDFJSAdapter:()=>c,PDFLibAdapter:()=>u});var r=function(t,e){return r=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])},r(t,e)};function n(t,e,r,n){return new(r||(r=Promise))(function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,u)}c((n=n.apply(t,e||[])).next())})}function o(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 i=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 a=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 n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.saveToFile=function(t,e){return n(this,void 0,void 0,function(){var r,n;return o(this,function(o){return r=new Blob([t],{type:"application/pdf"}),(n=document.createElement("a")).href=URL.createObjectURL(r),n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(n.href),[2]})})},e}(function(){function t(t){t&&(this.data=t.data,this.fieldMap=t.fieldMap,this.pdfTemplate=t.pdfTemplate,this.pdfLibraryAdapter=t.pdfLibraryAdapter)}return t.prototype.getPDFBytes=function(){return n(this,void 0,void 0,function(){var t,e,r;return o(this,function(n){switch(n.label){case 0:return t=new i(this.fieldMap),e=t.mapData(this.data),[4,null===(r=this.pdfLibraryAdapter)||void 0===r?void 0:r.fillForm(this.pdfTemplate,e)];case 1:return[2,n.sent()]}})})},t.prototype.raw=function(t){return n(this,void 0,void 0,function(){var e,r;return o(this,function(n){switch(n.label){case 0:return[4,this.getPDFBytes()];case 1:return e=n.sent(),t&&e?"dataurlstring"==t?[2,"data:application/pdf;base64,"+btoa(String.fromCharCode.apply(null,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 n(this,arguments,void 0,function(t){var e;return void 0===t&&(t="FilledForm.pdf"),o(this,function(r){switch(r.label){case 0:return[4,this.getPDFBytes()];case 1:return(e=r.sent())?[4,this.saveToFile(e,t)]:[2];case 2:return r.sent(),[2]}})})},t}()),u=function(){function t(t){this.pdfLibrary=t}return t.prototype.fillForm=function(t,e){return n(this,void 0,void 0,function(){var r,n,i,a,u,c,s;return o(this,function(o){switch(o.label){case 0:return r=this.pdfLibrary,n=r.PDFDocument,i=r.PDFTextField,a=r.PDFCheckBox,u=r.PDFRadioGroup,c=r.PDFDropdown,[4,n.load(t)];case 1:return s=o.sent(),s.getForm().getFields().forEach(function(t){var r=t.getName(),n=e[r];null!=n&&(t instanceof i?t.setText(n):t instanceof a?n?t.check():t.uncheck():(t instanceof u||t instanceof c)&&t.select(n.toString()))}),[4,s.save()];case 2:return[2,o.sent()]}})})},t}(),c=function(){function t(t){this.pdfLibrary=t}return t.prototype.fillForm=function(t,e){return n(this,void 0,void 0,function(){var r,n,i;return o(this,function(o){switch(o.label){case 0:return[4,this.pdfLibrary.getDocument(t).promise];case 1:r=o.sent(),n=r.numPages,i=1,o.label=2;case 2:return i<=n?[4,r.getPage(i)]:[3,6];case 3:return[4,o.sent().getAnnotations()];case 4:o.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})}}}),o.label=5;case 5:return i++,[3,2];case 6:return[4,r.saveDocument()];case 7:return[2,o.sent()]}})})},t}();return e})());
|
package/pdf-form-filler.node.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
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,
|
|
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){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,r;return u(this,function(n){switch(n.label){case 0:return t=new s(this.fieldMap),e=t.mapData(this.data),[4,null===(r=this.pdfLibraryAdapter)||void 0===r?void 0:r.fillForm(this.pdfTemplate,e)];case 1:return[2,n.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&&e?"dataurlstring"==t?[2,"data:application/pdf;base64,"+btoa(String.fromCharCode.apply(null,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="FilledForm.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)]:[2];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,n,o;return u(this,function(i){switch(i.label){case 0:return[4,this.pdfLibrary.getDocument(t).promise];case 1:r=i.sent(),n=r.numPages,o=1,i.label=2;case 2:return o<=n?[4,r.getPage(o)]:[3,6];case 3:return[4,i.sent().getAnnotations()];case 4:i.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})}}}),i.label=5;case 5:return o++,[3,2];case 6:return[4,r.saveDocument()];case 7:return[2,i.sent()]}})})},t}();return o})());
|
package/survey.pdf.fonts.js
CHANGED