|
6 | 6 | * http://opensource.org/licenses/mit-license
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -(AcroForm = function (jsPDFAPI) { |
| 9 | +(window.AcroForm = function (jsPDFAPI) { |
10 | 10 | 'use strict';
|
| 11 | + |
| 12 | + var AcroForm = window.AcroForm; |
11 | 13 |
|
12 | 14 | AcroForm.scale = function (x) {
|
13 | 15 | return (x * (acroformPlugin.internal.scaleFactor / 1));// 1 = (96 / 72)
|
|
217 | 219 | var key = i;
|
218 | 220 | var form = fieldArray[i];
|
219 | 221 | // Start Writing the Object
|
220 |
| - this.internal.newObjectDeferredBegin(form.objId); |
| 222 | + this.internal.newObjectDeferredBegin(form && form.objId); |
221 | 223 |
|
222 | 224 | var content = "";
|
223 |
| - content += (form.getString()); |
| 225 | + content += form ? form.getString() : ''; |
224 | 226 | this.internal.out(content);
|
225 | 227 |
|
226 | 228 | delete fieldArray[key];
|
|
402 | 404 | };
|
403 | 405 | })(jsPDF.API);
|
404 | 406 |
|
| 407 | +var AcroForm = window.AcroForm; |
| 408 | + |
405 | 409 | AcroForm.internal = {};
|
406 | 410 |
|
407 | 411 | AcroForm.createFormXObject = function (formObject) {
|
@@ -757,10 +761,10 @@ AcroForm.internal.toPdfString = function (string) {
|
757 | 761 | string = string || "";
|
758 | 762 |
|
759 | 763 | // put Bracket at the Beginning of the String
|
760 |
| - if (String.indexOf('(', 0) !== 0) { |
| 764 | + if (string.indexOf('(') !== 0) { |
761 | 765 | string = '(' + string;
|
762 | 766 | }
|
763 |
| - |
| 767 | + |
764 | 768 | if (string.substring(string.length - 1) != ')') {
|
765 | 769 | string += '(';
|
766 | 770 | }
|
@@ -1043,7 +1047,8 @@ AcroForm.Field = function () {
|
1043 | 1047 |
|
1044 | 1048 | Object.defineProperty(this, 'hasAppearanceStream', {
|
1045 | 1049 | enumerable: false,
|
1046 |
| - configurable: true |
| 1050 | + configurable: true, |
| 1051 | + writable: true |
1047 | 1052 | });
|
1048 | 1053 | };
|
1049 | 1054 | AcroForm.Field.FieldNum = 0;
|
@@ -1088,9 +1093,11 @@ AcroForm.ChoiceField = function () {
|
1088 | 1093 | configurable: false
|
1089 | 1094 | });
|
1090 | 1095 | this.hasAppearanceStream = true;
|
1091 |
| - this.V.get = function () { |
1092 |
| - AcroForm.internal.toPdfString(); |
1093 |
| - }; |
| 1096 | + Object.defineProperty(this, 'V', { |
| 1097 | + get: function() { |
| 1098 | + AcroForm.internal.toPdfString(); |
| 1099 | + } |
| 1100 | + }); |
1094 | 1101 | };
|
1095 | 1102 | AcroForm.internal.inherit(AcroForm.ChoiceField, AcroForm.Field);
|
1096 | 1103 | window["ChoiceField"] = AcroForm.ChoiceField;
|
|
0 commit comments