@syncfusion/ej2-pdf 25.1.39 → 25.1.40

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.
@@ -36488,7 +36488,10 @@ class PdfPage {
36488
36488
  if (this._pageDictionary.has('Annots')) {
36489
36489
  const annots = this._getProperty('Annots');
36490
36490
  if (annots && Array.isArray(annots)) {
36491
- const widgets = this._crossReference._document.form._parseWidgetReferences();
36491
+ let widgets;
36492
+ if (this._crossReference._document._catalog._catalogDictionary.has('AcroForm')) {
36493
+ widgets = this._crossReference._document.form._parseWidgetReferences();
36494
+ }
36492
36495
  if (widgets && widgets.length > 0) {
36493
36496
  const validAnnotations = [];
36494
36497
  annots.forEach((entry) => {
@@ -43253,6 +43256,40 @@ function _decodeText(text, isColorSpace, isPassword) {
43253
43256
  }
43254
43257
  return text;
43255
43258
  }
43259
+ /**
43260
+ * Number of bytes required to save the number.
43261
+ *
43262
+ * @param {number} input number.
43263
+ * @returns {number} number of bytes.
43264
+ */
43265
+ function _getSize(input) {
43266
+ let size = 0;
43267
+ const uintMaxValue = 0xFFFFFFFF;
43268
+ const ushortMaxValue = 0xFFFF;
43269
+ const byteMaxValue = 0xFF;
43270
+ if (input <= uintMaxValue) {
43271
+ if (input <= ushortMaxValue) {
43272
+ if (input <= byteMaxValue) {
43273
+ size = 1;
43274
+ }
43275
+ else {
43276
+ size = 2;
43277
+ }
43278
+ }
43279
+ else {
43280
+ if (input <= (ushortMaxValue | (ushortMaxValue << 8))) {
43281
+ size = 3;
43282
+ }
43283
+ else {
43284
+ size = 4;
43285
+ }
43286
+ }
43287
+ }
43288
+ else {
43289
+ size = 8;
43290
+ }
43291
+ return size;
43292
+ }
43256
43293
 
43257
43294
  /* eslint-disable */
43258
43295
  let nameCache = Object.create(null);
@@ -44634,6 +44671,8 @@ class _PdfCatalog {
44634
44671
  this._crossReference._cacheMap.set(ref, form);
44635
44672
  this._catalogDictionary.set('AcroForm', ref);
44636
44673
  this._catalogDictionary._updated = true;
44674
+ this._crossReference._allowCatalog = true;
44675
+ form._updated = true;
44637
44676
  return form;
44638
44677
  }
44639
44678
  getPageDictionary(pageIndex) {
@@ -48236,39 +48275,40 @@ class _PdfCrossReference {
48236
48275
  }
48237
48276
  this._writeObject(archiveStream, buffer, archiveRef, cipher);
48238
48277
  }
48278
+ const formatValue = Math.max(_getSize(this._stream.bytes.length), _getSize(this._nextReferenceNumber));
48239
48279
  const newRef = this._getNextReference();
48240
48280
  const newStartXref = currentLength + buffer.length;
48241
48281
  const newXref = new _PdfDictionary(this);
48242
48282
  newXref.set('Type', _PdfName.get('XRef'));
48243
48283
  newXref.set('Index', indexes);
48244
- newXref.set('W', [1, 3, 1]);
48284
+ newXref.set('W', [1, formatValue, 1]);
48245
48285
  this._copyTrailer(newXref);
48246
48286
  if (this._ids && this._ids.length > 0) {
48247
48287
  newXref.update('ID', [this._ids[0], this._computeMessageDigest(newStartXref)]);
48248
48288
  }
48249
48289
  const newXrefData = [];
48250
48290
  this._writeLong(0, 1, newXrefData);
48251
- this._writeLong(1, 3, newXrefData);
48291
+ this._writeLong(1, formatValue, newXrefData);
48252
48292
  this._writeLong(-1, 1, newXrefData);
48253
48293
  if (uncompressedCount > 0) {
48254
48294
  for (let index = 0; index < uncompressedCount; index++) {
48255
48295
  this._writeLong(1, 1, newXrefData);
48256
- this._writeLong(uncompressedOffsets[index], 3, newXrefData); // eslint-disable-line
48296
+ this._writeLong(uncompressedOffsets[index], formatValue, newXrefData); // eslint-disable-line
48257
48297
  this._writeLong(0, 1, newXrefData);
48258
48298
  }
48259
48299
  }
48260
48300
  if (updatedCount > 0) {
48261
48301
  for (let index = 0; index < updatedCount; index++) {
48262
48302
  this._writeLong(2, 1, newXrefData);
48263
- this._writeLong(archiveRef.objectNumber, 3, newXrefData);
48303
+ this._writeLong(archiveRef.objectNumber, formatValue, newXrefData);
48264
48304
  this._writeLong(index, 1, newXrefData);
48265
48305
  }
48266
48306
  this._writeLong(1, 1, newXrefData);
48267
- this._writeLong(archiveOffset, 3, newXrefData);
48307
+ this._writeLong(archiveOffset, formatValue, newXrefData);
48268
48308
  this._writeLong(0, 1, newXrefData);
48269
48309
  }
48270
48310
  this._writeLong(1, 1, newXrefData);
48271
- this._writeLong(newStartXref, 3, newXrefData);
48311
+ this._writeLong(newStartXref, formatValue, newXrefData);
48272
48312
  this._writeLong(0, 1, newXrefData);
48273
48313
  newXref.set('Length', newXrefData.length);
48274
48314
  const newXrefStream = new _PdfStream(newXrefData, newXref, 0, newXrefData.length);
@@ -48320,7 +48360,8 @@ class _PdfCrossReference {
48320
48360
  return array;
48321
48361
  }
48322
48362
  _copyTrailer(newXref) {
48323
- newXref.set('Size', this._nextReferenceNumber);
48363
+ const reference = this._getNextReference();
48364
+ newXref.set('Size', reference.objectNumber);
48324
48365
  newXref.set('Prev', this._prevXRefOffset);
48325
48366
  const root = this._trailer.getRaw('Root'); // eslint-disable-line
48326
48367
  if (typeof root !== 'undefined' && root !== null) {
@@ -48757,7 +48798,6 @@ class PdfForm {
48757
48798
  this._dictionary.update('Fields', this._fields);
48758
48799
  this._parsedFields.set(this._fields.length - 1, field);
48759
48800
  field._form = this;
48760
- this._crossReference._allowCatalog = true;
48761
48801
  this._crossReference._root._updated = true;
48762
48802
  if (field._kidsCount > 0) {
48763
48803
  for (let i = 0; i < field._kidsCount; i++) {
@@ -51919,19 +51959,21 @@ class PdfDocument {
51919
51959
  this._doPostProcessOnAnnotations(isFlatten);
51920
51960
  }
51921
51961
  _doPostProcessOnFormFields(isFlatten = false) {
51922
- this.form._doPostProcess(isFlatten);
51923
- if (isFlatten) {
51924
- const formObject = this._catalog._catalogDictionary.getRaw('AcroForm');
51925
- const dictionary = new _PdfDictionary(this._crossReference);
51926
- dictionary._updated = true;
51927
- if (formObject instanceof _PdfReference) {
51928
- this._crossReference._cacheMap.set(formObject, dictionary);
51929
- }
51930
- else {
51931
- this.form._dictionary = dictionary;
51932
- this._crossReference._allowCatalog = true;
51962
+ if (this._catalog._catalogDictionary.has('AcroForm')) {
51963
+ this.form._doPostProcess(isFlatten);
51964
+ if (isFlatten) {
51965
+ const formObject = this._catalog._catalogDictionary.getRaw('AcroForm');
51966
+ const dictionary = new _PdfDictionary(this._crossReference);
51967
+ dictionary._updated = true;
51968
+ if (formObject instanceof _PdfReference) {
51969
+ this._crossReference._cacheMap.set(formObject, dictionary);
51970
+ }
51971
+ else {
51972
+ this.form._dictionary = dictionary;
51973
+ this._crossReference._allowCatalog = true;
51974
+ }
51975
+ this.form._clear();
51933
51976
  }
51934
- this.form._clear();
51935
51977
  }
51936
51978
  }
51937
51979
  _doPostProcessOnAnnotations(isFlatten = false) {
@@ -52850,5 +52892,5 @@ class PdfBitmap extends PdfImage {
52850
52892
  }
52851
52893
  }
52852
52894
 
52853
- export { _PdfBaseStream, _PdfStream, _PdfContentStream, _PdfNullStream, _ContentParser, _ContentLexer, _PdfRecord, _PdfDecodeStream, _PdfDecryptStream, PdfAnnotationFlag, PdfLineEndingStyle, PdfLineIntent, PdfLineCaptionType, PdfBorderStyle, PdfBorderEffectStyle, PdfRotationAngle, PdfCrossReferenceType, PdfHighlightMode, PdfTextAlignment, PdfFormFieldVisibility, PdfMeasurementUnit, PdfCircleMeasurementType, PdfRubberStampAnnotationIcon, PdfCheckBoxStyle, PdfTextMarkupAnnotationType, PdfPopupIcon, PdfAnnotationState, PdfAnnotationStateModel, PdfAttachmentIcon, PdfAnnotationIntent, PdfDestinationMode, DataFormat, PdfFormFieldsTabOrder, _PdfAnnotationType, _PdfGraphicsUnit, _FieldFlag, _SignatureFlag, _PdfCheckFieldState, PdfPermissionFlag, PdfPageOrientation, PdfTextDirection, PdfSubSuperScript, PdfBlendMode, PdfFillMode, PdfDashStyle, PdfLineCap, PdfLineJoin, _PdfWordWrapType, _FontDescriptorFlag, _TrueTypeCmapFormat, _TrueTypeCmapEncoding, _TrueTypePlatformID, _TrueTypeMicrosoftEncodingID, _TrueTypeMacintoshEncodingID, _TrueTypeCompositeGlyphFlag, _ImageFormat, _TokenType, PdfTextStyle, _PdfColorSpace, _PdfFlateStream, _PdfCatalog, _PdfCrossReference, PdfDocument, PdfAnnotationExportSettings, PdfFormFieldExportSettings, PdfPageSettings, PdfMargins, PdfFileStructure, PdfPage, PdfDestination, PdfBookmarkBase, PdfBookmark, PdfNamedDestination, _PdfNamedDestinationCollection, _PdfLexicalOperator, _PdfParser, _Linearization, _PdfName, _PdfCommand, _PdfReference, _PdfReferenceSet, _PdfReferenceSetCache, Dictionary, _PdfDictionary, _PdfNull, _clearPrimitiveCaches, _isName, _isCommand, PdfPredictorStream, _toUnsigned, _toSigned16, _toSigned32, _copyRange, _checkType, _getDecoder, _checkRotation, _getPageIndex, _annotationFlagsToString, _stringToAnnotationFlags, _stringToPdfString, _stringToBytes, _convertStringToBytes, _areArrayEqual, _numberToString, _areNotEqual, _bytesToString, _stringToUnicodeArray, _byteArrayToHexString, _hexStringToByteArray, _hexStringToString, _isWhiteSpace, _decode, _encode, _getInheritableProperty, _parseRectangle, _calculateBounds, _toRectangle, _fromRectangle, _getUpdatedBounds, _convertToColor, _parseColor, _mapBorderStyle, _mapBorderEffectStyle, _reverseMapEndingStyle, _mapLineEndingStyle, _mapHighlightMode, _reverseMapHighlightMode, _reverseMapBlendMode, _mapBlendMode, _floatToString, _addProcSet, _getNewGuidString, _escapePdfName, _getBezierArc, _findPage, _checkField, _getItemValue, _getStateTemplate, _getColorValue, _setMatrix, _styleToString, _stringToStyle, _mapMeasurementUnit, _mapMarkupAnnotationType, _reverseMarkupAnnotationType, _mapGraphicsUnit, _mapRubberStampIcon, _mapPopupIcon, _reverseMapAnnotationState, _mapAnnotationState, _reverseMapAnnotationStateModel, _mapAnnotationStateModel, _mapAttachmentIcon, _mapAnnotationIntent, _reverseMapPdfFontStyle, _getSpecialCharacter, _getLatinCharacter, _encodeValue, _getCommentsOrReview, _checkReview, _checkComment, _updateVisibility, _removeDuplicateReference, _removeDuplicateFromResources, _removeReferences, BaseException, FormatError, ParserEndOfFileException, _defaultToString, _obtainFontDetails, _getFontStyle, _mapFont, _tryParseFontStream, _checkInkPoints, _obtainDestination, _updateBounds, _decodeText, PdfAnnotationCollection, PdfPopupAnnotationCollection, PdfAnnotation, PdfComment, PdfLineAnnotation, PdfCircleAnnotation, PdfEllipseAnnotation, PdfSquareAnnotation, PdfRectangleAnnotation, PdfPolygonAnnotation, PdfPolyLineAnnotation, PdfAngleMeasurementAnnotation, PdfInkAnnotation, PdfPopupAnnotation, PdfFileLinkAnnotation, PdfUriAnnotation, PdfDocumentLinkAnnotation, PdfTextWebLinkAnnotation, PdfAttachmentAnnotation, Pdf3DAnnotation, PdfTextMarkupAnnotation, PdfWatermarkAnnotation, PdfRubberStampAnnotation, PdfSoundAnnotation, PdfFreeTextAnnotation, PdfRedactionAnnotation, PdfRichMediaAnnotation, PdfWidgetAnnotation, PdfStateItem, PdfRadioButtonListItem, PdfListFieldItem, PdfAnnotationCaption, PdfAnnotationLineEndingStyle, PdfInteractiveBorder, PdfAnnotationBorder, PdfBorderEffect, _PaintParameter, PdfAppearance, _PdfPaddings, _DecompressedOutput, _DeflateStream, _Inflater, _HuffmanTree, _InBuffer, _InflaterState, _BlockType, _PdfFontMetrics, _WidthTable, _StandardWidthTable, _CjkWidthTable, _CjkWidth, _CjkSameWidth, _CjkDifferentWidth, PdfFont, PdfStandardFont, PdfCjkStandardFont, PdfTrueTypeFont, _PdfStandardFontMetricsFactory, _PdfCjkStandardFontMetricsFactory, _PdfCjkFontDescriptorFactory, PdfFontStyle, PdfFontFamily, PdfCjkFontFamily, _UnicodeLine, PdfStringFormat, PdfVerticalAlignment, _PdfStringLayouter, _PdfStringLayoutResult, _LineInfo, _LineType, _StringTokenizer, _TrueTypeReader, _TrueTypeNameRecord, _TrueTypeMetrics, _TrueTypeLongHorMetric, _TrueTypeGlyph, _TrueTypeLocaTable, _TrueTypeGlyphHeader, _BigEndianWriter, _TrueTypeTableInfo, _TrueTypeOS2Table, _TrueTypePostTable, _TrueTypeNameTable, _TrueTypeMicrosoftCmapSubTable, _TrueTypeHorizontalHeaderTable, _TrueTypeHeadTable, _TrueTypeCmapTable, _TrueTypeCmapSubTable, _TrueTypeAppleCmapSubTable, _TrueTypeTrimmedCmapSubTable, _UnicodeTrueTypeFont, PdfField, PdfTextBoxField, PdfButtonField, PdfCheckBoxField, PdfRadioButtonListField, PdfListField, PdfComboBoxField, PdfListBoxField, PdfSignatureField, _PdfDefaultAppearance, PdfForm, PdfGraphics, _PdfTransformationMatrix, _Matrix, PdfGraphicsState, _TextRenderingMode, PdfBrush, PdfPen, _PdfUnitConvertor, _PdfPath, _PathPointType, _PdfStreamWriter, PdfTemplate, _Bidirectional, _RtlCharacters, _ArabicShapeRenderer, _ArabicShape, _RtlRenderer, _ImageDecoder, PdfBitmap, PdfImage, _PngDecoder, _JpegDecoder, _PdfEncryptor, _MD5, _Sha256, _Sha512, _Word64, _EncryptionKey, _BasicEncryption, _AdvancedEncryption, _Cipher, _NormalCipherFour, _AdvancedEncryptionBaseCipher, _AdvancedEncryption128Cipher, _AdvancedEncryption256Cipher, _NullCipher, _CipherTransform, _ExportHelper, _XfdfDocument, _FontStructure, _XmlWriter, _Namespace, _XmlElement, _XmlAttribute, _FdfDocument, _FdfHelper, _JsonDocument, _XmlDocument };
52895
+ export { _PdfBaseStream, _PdfStream, _PdfContentStream, _PdfNullStream, _ContentParser, _ContentLexer, _PdfRecord, _PdfDecodeStream, _PdfDecryptStream, PdfAnnotationFlag, PdfLineEndingStyle, PdfLineIntent, PdfLineCaptionType, PdfBorderStyle, PdfBorderEffectStyle, PdfRotationAngle, PdfCrossReferenceType, PdfHighlightMode, PdfTextAlignment, PdfFormFieldVisibility, PdfMeasurementUnit, PdfCircleMeasurementType, PdfRubberStampAnnotationIcon, PdfCheckBoxStyle, PdfTextMarkupAnnotationType, PdfPopupIcon, PdfAnnotationState, PdfAnnotationStateModel, PdfAttachmentIcon, PdfAnnotationIntent, PdfDestinationMode, DataFormat, PdfFormFieldsTabOrder, _PdfAnnotationType, _PdfGraphicsUnit, _FieldFlag, _SignatureFlag, _PdfCheckFieldState, PdfPermissionFlag, PdfPageOrientation, PdfTextDirection, PdfSubSuperScript, PdfBlendMode, PdfFillMode, PdfDashStyle, PdfLineCap, PdfLineJoin, _PdfWordWrapType, _FontDescriptorFlag, _TrueTypeCmapFormat, _TrueTypeCmapEncoding, _TrueTypePlatformID, _TrueTypeMicrosoftEncodingID, _TrueTypeMacintoshEncodingID, _TrueTypeCompositeGlyphFlag, _ImageFormat, _TokenType, PdfTextStyle, _PdfColorSpace, _PdfFlateStream, _PdfCatalog, _PdfCrossReference, PdfDocument, PdfAnnotationExportSettings, PdfFormFieldExportSettings, PdfPageSettings, PdfMargins, PdfFileStructure, PdfPage, PdfDestination, PdfBookmarkBase, PdfBookmark, PdfNamedDestination, _PdfNamedDestinationCollection, _PdfLexicalOperator, _PdfParser, _Linearization, _PdfName, _PdfCommand, _PdfReference, _PdfReferenceSet, _PdfReferenceSetCache, Dictionary, _PdfDictionary, _PdfNull, _clearPrimitiveCaches, _isName, _isCommand, PdfPredictorStream, _toUnsigned, _toSigned16, _toSigned32, _copyRange, _checkType, _getDecoder, _checkRotation, _getPageIndex, _annotationFlagsToString, _stringToAnnotationFlags, _stringToPdfString, _stringToBytes, _convertStringToBytes, _areArrayEqual, _numberToString, _areNotEqual, _bytesToString, _stringToUnicodeArray, _byteArrayToHexString, _hexStringToByteArray, _hexStringToString, _isWhiteSpace, _decode, _encode, _getInheritableProperty, _parseRectangle, _calculateBounds, _toRectangle, _fromRectangle, _getUpdatedBounds, _convertToColor, _parseColor, _mapBorderStyle, _mapBorderEffectStyle, _reverseMapEndingStyle, _mapLineEndingStyle, _mapHighlightMode, _reverseMapHighlightMode, _reverseMapBlendMode, _mapBlendMode, _floatToString, _addProcSet, _getNewGuidString, _escapePdfName, _getBezierArc, _findPage, _checkField, _getItemValue, _getStateTemplate, _getColorValue, _setMatrix, _styleToString, _stringToStyle, _mapMeasurementUnit, _mapMarkupAnnotationType, _reverseMarkupAnnotationType, _mapGraphicsUnit, _mapRubberStampIcon, _mapPopupIcon, _reverseMapAnnotationState, _mapAnnotationState, _reverseMapAnnotationStateModel, _mapAnnotationStateModel, _mapAttachmentIcon, _mapAnnotationIntent, _reverseMapPdfFontStyle, _getSpecialCharacter, _getLatinCharacter, _encodeValue, _getCommentsOrReview, _checkReview, _checkComment, _updateVisibility, _removeDuplicateReference, _removeDuplicateFromResources, _removeReferences, BaseException, FormatError, ParserEndOfFileException, _defaultToString, _obtainFontDetails, _getFontStyle, _mapFont, _tryParseFontStream, _checkInkPoints, _obtainDestination, _updateBounds, _decodeText, _getSize, PdfAnnotationCollection, PdfPopupAnnotationCollection, PdfAnnotation, PdfComment, PdfLineAnnotation, PdfCircleAnnotation, PdfEllipseAnnotation, PdfSquareAnnotation, PdfRectangleAnnotation, PdfPolygonAnnotation, PdfPolyLineAnnotation, PdfAngleMeasurementAnnotation, PdfInkAnnotation, PdfPopupAnnotation, PdfFileLinkAnnotation, PdfUriAnnotation, PdfDocumentLinkAnnotation, PdfTextWebLinkAnnotation, PdfAttachmentAnnotation, Pdf3DAnnotation, PdfTextMarkupAnnotation, PdfWatermarkAnnotation, PdfRubberStampAnnotation, PdfSoundAnnotation, PdfFreeTextAnnotation, PdfRedactionAnnotation, PdfRichMediaAnnotation, PdfWidgetAnnotation, PdfStateItem, PdfRadioButtonListItem, PdfListFieldItem, PdfAnnotationCaption, PdfAnnotationLineEndingStyle, PdfInteractiveBorder, PdfAnnotationBorder, PdfBorderEffect, _PaintParameter, PdfAppearance, _PdfPaddings, _DecompressedOutput, _DeflateStream, _Inflater, _HuffmanTree, _InBuffer, _InflaterState, _BlockType, _PdfFontMetrics, _WidthTable, _StandardWidthTable, _CjkWidthTable, _CjkWidth, _CjkSameWidth, _CjkDifferentWidth, PdfFont, PdfStandardFont, PdfCjkStandardFont, PdfTrueTypeFont, _PdfStandardFontMetricsFactory, _PdfCjkStandardFontMetricsFactory, _PdfCjkFontDescriptorFactory, PdfFontStyle, PdfFontFamily, PdfCjkFontFamily, _UnicodeLine, PdfStringFormat, PdfVerticalAlignment, _PdfStringLayouter, _PdfStringLayoutResult, _LineInfo, _LineType, _StringTokenizer, _TrueTypeReader, _TrueTypeNameRecord, _TrueTypeMetrics, _TrueTypeLongHorMetric, _TrueTypeGlyph, _TrueTypeLocaTable, _TrueTypeGlyphHeader, _BigEndianWriter, _TrueTypeTableInfo, _TrueTypeOS2Table, _TrueTypePostTable, _TrueTypeNameTable, _TrueTypeMicrosoftCmapSubTable, _TrueTypeHorizontalHeaderTable, _TrueTypeHeadTable, _TrueTypeCmapTable, _TrueTypeCmapSubTable, _TrueTypeAppleCmapSubTable, _TrueTypeTrimmedCmapSubTable, _UnicodeTrueTypeFont, PdfField, PdfTextBoxField, PdfButtonField, PdfCheckBoxField, PdfRadioButtonListField, PdfListField, PdfComboBoxField, PdfListBoxField, PdfSignatureField, _PdfDefaultAppearance, PdfForm, PdfGraphics, _PdfTransformationMatrix, _Matrix, PdfGraphicsState, _TextRenderingMode, PdfBrush, PdfPen, _PdfUnitConvertor, _PdfPath, _PathPointType, _PdfStreamWriter, PdfTemplate, _Bidirectional, _RtlCharacters, _ArabicShapeRenderer, _ArabicShape, _RtlRenderer, _ImageDecoder, PdfBitmap, PdfImage, _PngDecoder, _JpegDecoder, _PdfEncryptor, _MD5, _Sha256, _Sha512, _Word64, _EncryptionKey, _BasicEncryption, _AdvancedEncryption, _Cipher, _NormalCipherFour, _AdvancedEncryptionBaseCipher, _AdvancedEncryption128Cipher, _AdvancedEncryption256Cipher, _NullCipher, _CipherTransform, _ExportHelper, _XfdfDocument, _FontStructure, _XmlWriter, _Namespace, _XmlElement, _XmlAttribute, _FdfDocument, _FdfHelper, _JsonDocument, _XmlDocument };
52854
52896
  //# sourceMappingURL=ej2-pdf.es2015.js.map