@syncfusion/ej2-pdf-export 30.2.4 → 31.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/dist/ej2-pdf-export.min.js +3 -3
- package/dist/ej2-pdf-export.umd.min.js +3 -3
- package/dist/ej2-pdf-export.umd.min.js.map +1 -1
- package/dist/es6/ej2-pdf-export.es2015.js +142 -23
- package/dist/es6/ej2-pdf-export.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf-export.es5.js +148 -21
- package/dist/es6/ej2-pdf-export.es5.js.map +1 -1
- package/dist/global/ej2-pdf-export.min.js +3 -3
- package/dist/global/ej2-pdf-export.min.js.map +1 -1
- package/dist/global/index.d.ts +2 -2
- package/package.json +2 -2
- package/src/implementation/input-output/pdf-cross-table.js +2 -1
- package/src/implementation/input-output/pdf-writer.d.ts +77 -14
- package/src/implementation/input-output/pdf-writer.js +146 -20
|
@@ -6014,15 +6014,117 @@ PdfFont.charSizeMultiplier = 0.001;
|
|
|
6014
6014
|
*/
|
|
6015
6015
|
PdfFont.syncObject = new Object();
|
|
6016
6016
|
|
|
6017
|
+
/**
|
|
6018
|
+
* Helper class for chunk buffer.
|
|
6019
|
+
* @private
|
|
6020
|
+
*/
|
|
6021
|
+
class _PdfChunkBuffer {
|
|
6022
|
+
/**
|
|
6023
|
+
* Initialize an instance of `_PdfChunkBuffer` class.
|
|
6024
|
+
* @private
|
|
6025
|
+
*/
|
|
6026
|
+
constructor(chunkSize = 1048576) {
|
|
6027
|
+
/**
|
|
6028
|
+
* Specifies the `chunks`.
|
|
6029
|
+
* @private
|
|
6030
|
+
*/
|
|
6031
|
+
this.chunks = [];
|
|
6032
|
+
/**
|
|
6033
|
+
* Specifies the `offset`.
|
|
6034
|
+
* @private
|
|
6035
|
+
*/
|
|
6036
|
+
this.offset = 0;
|
|
6037
|
+
/**
|
|
6038
|
+
* Specifies the `committed`.
|
|
6039
|
+
* @private
|
|
6040
|
+
*/
|
|
6041
|
+
this.committed = 0;
|
|
6042
|
+
this.chunkSize = chunkSize;
|
|
6043
|
+
this.current = new Uint8Array(this.chunkSize);
|
|
6044
|
+
this.chunks.push(this.current);
|
|
6045
|
+
}
|
|
6046
|
+
/**
|
|
6047
|
+
* Gets the `length`.
|
|
6048
|
+
* @private
|
|
6049
|
+
*/
|
|
6050
|
+
get length() {
|
|
6051
|
+
return this.committed + this.offset;
|
|
6052
|
+
}
|
|
6053
|
+
/**
|
|
6054
|
+
* Grows the buffer by allocating a new chunk.
|
|
6055
|
+
* @private
|
|
6056
|
+
*/
|
|
6057
|
+
grow() {
|
|
6058
|
+
this.committed += this.offset;
|
|
6059
|
+
this.current = new Uint8Array(this.chunkSize);
|
|
6060
|
+
this.chunks.push(this.current);
|
|
6061
|
+
this.offset = 0;
|
|
6062
|
+
}
|
|
6063
|
+
/**
|
|
6064
|
+
* Writes ASCII string as bytes (each charCodeAt masked to 0..255).
|
|
6065
|
+
* @private
|
|
6066
|
+
*/
|
|
6067
|
+
writeAscii(str) {
|
|
6068
|
+
let idx = 0;
|
|
6069
|
+
while (idx < str.length) {
|
|
6070
|
+
if (this.offset >= this.current.byteLength) {
|
|
6071
|
+
this.grow();
|
|
6072
|
+
}
|
|
6073
|
+
const space = this.current.byteLength - this.offset;
|
|
6074
|
+
const toWrite = Math.min(space, str.length - idx);
|
|
6075
|
+
for (let i = 0; i < toWrite; i++) {
|
|
6076
|
+
this.current[this.offset + i] = str.charCodeAt(idx + i) & 0xFF;
|
|
6077
|
+
}
|
|
6078
|
+
this.offset += toWrite;
|
|
6079
|
+
idx += toWrite;
|
|
6080
|
+
}
|
|
6081
|
+
}
|
|
6082
|
+
/**
|
|
6083
|
+
* Converts to `Uint8Array`.
|
|
6084
|
+
* @private
|
|
6085
|
+
*/
|
|
6086
|
+
toUint8Array() {
|
|
6087
|
+
const total = this.length;
|
|
6088
|
+
const out = new Uint8Array(total);
|
|
6089
|
+
let pos = 0;
|
|
6090
|
+
const lastIdx = this.chunks.length - 1;
|
|
6091
|
+
for (let i = 0; i <= lastIdx; i++) {
|
|
6092
|
+
const chunk = this.chunks[i];
|
|
6093
|
+
if (i === lastIdx) {
|
|
6094
|
+
out.set(chunk.subarray(0, this.offset), pos);
|
|
6095
|
+
pos += this.offset;
|
|
6096
|
+
}
|
|
6097
|
+
else {
|
|
6098
|
+
out.set(chunk, pos);
|
|
6099
|
+
pos += chunk.byteLength;
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6102
|
+
return out;
|
|
6103
|
+
}
|
|
6104
|
+
/**
|
|
6105
|
+
* Destroys the array buffer.
|
|
6106
|
+
* @private
|
|
6107
|
+
*/
|
|
6108
|
+
destroy() {
|
|
6109
|
+
this.chunks = [];
|
|
6110
|
+
this.current = undefined;
|
|
6111
|
+
this.offset = 0;
|
|
6112
|
+
this.committed = 0;
|
|
6113
|
+
}
|
|
6114
|
+
}
|
|
6017
6115
|
/**
|
|
6018
6116
|
* Used to `write a string` into output file.
|
|
6019
6117
|
* @private
|
|
6020
6118
|
*/
|
|
6021
6119
|
class PdfWriter {
|
|
6022
6120
|
constructor(stream) {
|
|
6121
|
+
/**
|
|
6122
|
+
* Specifies the `byteCountForStreamWriter`.
|
|
6123
|
+
* @private
|
|
6124
|
+
*/
|
|
6125
|
+
this.byteCountForStreamWriter = 0;
|
|
6023
6126
|
this.streamWriter = stream;
|
|
6024
6127
|
}
|
|
6025
|
-
//properties
|
|
6026
6128
|
/**
|
|
6027
6129
|
* Gets and Sets the `document`.
|
|
6028
6130
|
* @private
|
|
@@ -6038,14 +6140,18 @@ class PdfWriter {
|
|
|
6038
6140
|
* @private
|
|
6039
6141
|
*/
|
|
6040
6142
|
get position() {
|
|
6041
|
-
|
|
6143
|
+
if (this.streamWriter instanceof PdfWriterHelper) {
|
|
6144
|
+
return this.streamWriter.buffer.size;
|
|
6145
|
+
}
|
|
6146
|
+
// For StreamWriter, we keep an internal count based on written characters
|
|
6147
|
+
return this.byteCountForStreamWriter;
|
|
6042
6148
|
}
|
|
6043
6149
|
/**
|
|
6044
6150
|
* Gets the `length` of the stream'.
|
|
6045
6151
|
* @private
|
|
6046
6152
|
*/
|
|
6047
6153
|
get length() {
|
|
6048
|
-
return this.
|
|
6154
|
+
return this.position;
|
|
6049
6155
|
}
|
|
6050
6156
|
/**
|
|
6051
6157
|
* Gets the `stream`.
|
|
@@ -6054,14 +6160,21 @@ class PdfWriter {
|
|
|
6054
6160
|
get stream() {
|
|
6055
6161
|
return this.streamWriter;
|
|
6056
6162
|
}
|
|
6057
|
-
//public Methods
|
|
6058
6163
|
/**
|
|
6059
6164
|
* `Writes the specified data`.
|
|
6060
6165
|
* @private
|
|
6061
6166
|
*/
|
|
6062
|
-
write(
|
|
6063
|
-
|
|
6064
|
-
|
|
6167
|
+
write(data) {
|
|
6168
|
+
if (typeof data === 'number') {
|
|
6169
|
+
data = String.fromCharCode(data);
|
|
6170
|
+
}
|
|
6171
|
+
if (this.streamWriter instanceof PdfWriterHelper) {
|
|
6172
|
+
this.streamWriter.write(data);
|
|
6173
|
+
}
|
|
6174
|
+
else {
|
|
6175
|
+
this.streamWriter.write(data);
|
|
6176
|
+
this.byteCountForStreamWriter += data.length;
|
|
6177
|
+
}
|
|
6065
6178
|
}
|
|
6066
6179
|
}
|
|
6067
6180
|
/**
|
|
@@ -6073,8 +6186,8 @@ class PdfWriterHelper {
|
|
|
6073
6186
|
* Initialize an instance of `PdfWriterHelper` class.
|
|
6074
6187
|
* @private
|
|
6075
6188
|
*/
|
|
6076
|
-
constructor() {
|
|
6077
|
-
this.buffer = new PdfArrayBuffer();
|
|
6189
|
+
constructor(chunkSize = 1048576) {
|
|
6190
|
+
this.buffer = new PdfArrayBuffer(chunkSize);
|
|
6078
6191
|
}
|
|
6079
6192
|
/**
|
|
6080
6193
|
* Writes the specified data.
|
|
@@ -6103,33 +6216,38 @@ class PdfArrayBuffer {
|
|
|
6103
6216
|
* Initialize an instance of `PdfArrayBuffer` class.
|
|
6104
6217
|
* @private
|
|
6105
6218
|
*/
|
|
6106
|
-
constructor() {
|
|
6107
|
-
this.
|
|
6219
|
+
constructor(chunkSize = 1048576) {
|
|
6220
|
+
this.buf = new _PdfChunkBuffer(chunkSize);
|
|
6108
6221
|
}
|
|
6109
6222
|
/**
|
|
6110
6223
|
* Gets the `size`.
|
|
6111
6224
|
* @private
|
|
6112
6225
|
*/
|
|
6113
6226
|
get size() {
|
|
6114
|
-
return this.
|
|
6227
|
+
return this.buf.length;
|
|
6115
6228
|
}
|
|
6116
6229
|
/**
|
|
6117
6230
|
* Writes the specified data.
|
|
6118
6231
|
* @private
|
|
6119
6232
|
*/
|
|
6120
6233
|
write(value) {
|
|
6121
|
-
|
|
6122
|
-
this.buffer.push(value.charCodeAt(i) & 0xff);
|
|
6123
|
-
}
|
|
6234
|
+
this.buf.writeAscii(value);
|
|
6124
6235
|
}
|
|
6125
6236
|
/**
|
|
6126
|
-
*
|
|
6237
|
+
* Converts to `Uint8Array`.
|
|
6238
|
+
* @private
|
|
6239
|
+
*/
|
|
6240
|
+
toUint8Array() {
|
|
6241
|
+
return this.buf.toUint8Array();
|
|
6242
|
+
}
|
|
6243
|
+
/**
|
|
6244
|
+
* Destroys the buffer.
|
|
6127
6245
|
* @private
|
|
6128
6246
|
*/
|
|
6129
6247
|
destroy() {
|
|
6130
|
-
if (this.
|
|
6131
|
-
this.
|
|
6132
|
-
this.
|
|
6248
|
+
if (this.buf) {
|
|
6249
|
+
this.buf.destroy();
|
|
6250
|
+
this.buf = undefined;
|
|
6133
6251
|
}
|
|
6134
6252
|
}
|
|
6135
6253
|
}
|
|
@@ -7313,7 +7431,8 @@ class PdfCrossTable {
|
|
|
7313
7431
|
*/
|
|
7314
7432
|
_save(writer) {
|
|
7315
7433
|
this._saveProcess(writer);
|
|
7316
|
-
|
|
7434
|
+
const helper = writer.stream;
|
|
7435
|
+
return helper.buffer.toUint8Array();
|
|
7317
7436
|
}
|
|
7318
7437
|
/**
|
|
7319
7438
|
* `Saves the endess` of the file.
|
|
@@ -19843,13 +19962,13 @@ class PdfDocument extends PdfDocumentBase {
|
|
|
19843
19962
|
* @private
|
|
19844
19963
|
*/
|
|
19845
19964
|
_docSave() {
|
|
19846
|
-
|
|
19965
|
+
const stream = new PdfWriterHelper();
|
|
19847
19966
|
this.checkPagesPresence();
|
|
19848
19967
|
if (stream === null) {
|
|
19849
19968
|
throw new Error('ArgumentNullException : stream');
|
|
19850
19969
|
}
|
|
19851
19970
|
this.streamWriter = stream;
|
|
19852
|
-
|
|
19971
|
+
const writer = new PdfWriter(stream);
|
|
19853
19972
|
writer.document = this;
|
|
19854
19973
|
return this.crossTable._save(writer);
|
|
19855
19974
|
}
|
|
@@ -33055,5 +33174,5 @@ class PdfPageTemplateElement {
|
|
|
33055
33174
|
}
|
|
33056
33175
|
}
|
|
33057
33176
|
|
|
33058
|
-
export { ArabicShape, ArabicShapeRenderer, BeginPageLayoutEventArgs, Bidi, ByteArray, Dictionary, DictionaryProperties, DuplexMode, ElementLayouter, EndPageLayoutEventArgs, FontDescriptorFlags, FontEncoding, GetResourceEventHandler, GridCellEventArgs, Guid, ImageDecoder, ImageFormat, InternalEnum, LineInfo, LineType, Matrix, ObjectInfo, ObjectStatus, ObjectType, Operators, PageAddedEventArgs, PageScalingMode, PageSettingsState, PathPointType, PdfAction, PdfActionLinkAnnotation, PdfAlignmentStyle, PdfAnnotation, PdfAnnotationCollection, PdfArc, PdfArray, PdfArrayBuffer, PdfBitmap, PdfBlend, PdfBlendMode, PdfBorderOverlapStyle, PdfBorders, PdfBrush, PdfBrushes, PdfCacheCollection, PdfCancelEventArgs, PdfCatalog, PdfCollection, PdfColor, PdfColorBlend, PdfColorSpace, PdfCompositeField, PdfCrossTable, PdfDashStyle, PdfDestination, PdfDestinationMode, PdfDictionary, PdfDockStyle, PdfDocument, PdfDocumentBase, PdfDocumentLinkAnnotation, PdfDocumentPageCollection, PdfDocumentTemplate, PdfFillMode, PdfFont, PdfFontFamily, PdfFontMetrics, PdfFontStyle, PdfFontType, PdfFunction, PdfGradientBrush, PdfGraphics, PdfGraphicsState, PdfGraphicsUnit, PdfGrid, PdfGridBeginCellDrawEventArgs, PdfGridBeginPageLayoutEventArgs, PdfGridCell, PdfGridCellCollection, PdfGridCellStyle, PdfGridColumn, PdfGridColumnCollection, PdfGridEndCellDrawEventArgs, PdfGridEndPageLayoutEventArgs, PdfGridHeaderCollection, PdfGridImagePosition, PdfGridLayoutFormat, PdfGridLayoutResult, PdfGridLayouter, PdfGridRow, PdfGridRowCollection, PdfGridRowStyle, PdfGridStyle, PdfGridStyleBase, PdfHorizontalAlignment, PdfHorizontalOverflowType, PdfImage, PdfLayoutBreakType, PdfLayoutElement, PdfLayoutFormat, PdfLayoutParams, PdfLayoutResult, PdfLayoutType, PdfLineCap, PdfLineJoin, PdfLinearGradientBrush, PdfLinkAnnotation, PdfMainObjectCollection, PdfMargins, PdfName, PdfNumber, PdfNumberStyle, PdfPaddings, PdfPage, PdfPageBase, PdfPageCountField, PdfPageLayer, PdfPageLayerCollection, PdfPageLayout, PdfPageMode, PdfPageNumberField, PdfPageOrientation, PdfPageRotateAngle, PdfPageSettings, PdfPageSize, PdfPageTemplateElement, PdfPath, PdfPen, PdfRadialGradientBrush, PdfReference, PdfReferenceHolder, PdfResources, PdfSampledFunction, PdfSection, PdfSectionCollection, PdfSectionPageCollection, PdfSectionTemplate, PdfSolidBrush, PdfStandardFont, PdfStandardFontMetricsFactory, PdfStream, PdfStreamWriter, PdfString, PdfStringFormat, PdfStringLayoutResult, PdfStringLayouter, PdfSubSuperScript, PdfTemplate, PdfTextAlignment, PdfTextDirection, PdfTextElement, PdfTextLayoutResult, PdfTextWebLink, PdfTilingBrush, PdfTransformationMatrix, PdfTransparency, PdfTrueTypeFont, PdfUriAction, PdfUriAnnotation, PdfVerticalAlignment, PdfViewerPreferences, PdfWordWrapType, PdfWriter, PdfWriterHelper, PointF, ProcedureSets, Rectangle, RectangleF, RegisteredObject, RowLayoutResult, RtlCharacters, RtlRenderer, SaveAnnotationEventHandler, SaveCmapEventHandler, SaveDescendantFontEventHandler, SaveFontDictionaryEventHandler, SaveFontProgramEventHandler, SaveSectionCollectionEventHandler, SaveSectionEventHandler, SaveTemplateEventHandler, SizeF, StandardWidthTable, StringTokenizer, TemplateType, TextLayouter, TextPageLayoutResult, TextRenderingMode, TtfCmapEncoding, TtfCmapFormat, TtfCompositeGlyphFlags, TtfMacintoshEncodingID, TtfMicrosoftEncodingID, TtfPlatformID, WidthTable, defaultToString };
|
|
33177
|
+
export { ArabicShape, ArabicShapeRenderer, BeginPageLayoutEventArgs, Bidi, ByteArray, Dictionary, DictionaryProperties, DuplexMode, ElementLayouter, EndPageLayoutEventArgs, FontDescriptorFlags, FontEncoding, GetResourceEventHandler, GridCellEventArgs, Guid, ImageDecoder, ImageFormat, InternalEnum, LineInfo, LineType, Matrix, ObjectInfo, ObjectStatus, ObjectType, Operators, PageAddedEventArgs, PageScalingMode, PageSettingsState, PathPointType, PdfAction, PdfActionLinkAnnotation, PdfAlignmentStyle, PdfAnnotation, PdfAnnotationCollection, PdfArc, PdfArray, PdfArrayBuffer, PdfBitmap, PdfBlend, PdfBlendMode, PdfBorderOverlapStyle, PdfBorders, PdfBrush, PdfBrushes, PdfCacheCollection, PdfCancelEventArgs, PdfCatalog, PdfCollection, PdfColor, PdfColorBlend, PdfColorSpace, PdfCompositeField, PdfCrossTable, PdfDashStyle, PdfDestination, PdfDestinationMode, PdfDictionary, PdfDockStyle, PdfDocument, PdfDocumentBase, PdfDocumentLinkAnnotation, PdfDocumentPageCollection, PdfDocumentTemplate, PdfFillMode, PdfFont, PdfFontFamily, PdfFontMetrics, PdfFontStyle, PdfFontType, PdfFunction, PdfGradientBrush, PdfGraphics, PdfGraphicsState, PdfGraphicsUnit, PdfGrid, PdfGridBeginCellDrawEventArgs, PdfGridBeginPageLayoutEventArgs, PdfGridCell, PdfGridCellCollection, PdfGridCellStyle, PdfGridColumn, PdfGridColumnCollection, PdfGridEndCellDrawEventArgs, PdfGridEndPageLayoutEventArgs, PdfGridHeaderCollection, PdfGridImagePosition, PdfGridLayoutFormat, PdfGridLayoutResult, PdfGridLayouter, PdfGridRow, PdfGridRowCollection, PdfGridRowStyle, PdfGridStyle, PdfGridStyleBase, PdfHorizontalAlignment, PdfHorizontalOverflowType, PdfImage, PdfLayoutBreakType, PdfLayoutElement, PdfLayoutFormat, PdfLayoutParams, PdfLayoutResult, PdfLayoutType, PdfLineCap, PdfLineJoin, PdfLinearGradientBrush, PdfLinkAnnotation, PdfMainObjectCollection, PdfMargins, PdfName, PdfNumber, PdfNumberStyle, PdfPaddings, PdfPage, PdfPageBase, PdfPageCountField, PdfPageLayer, PdfPageLayerCollection, PdfPageLayout, PdfPageMode, PdfPageNumberField, PdfPageOrientation, PdfPageRotateAngle, PdfPageSettings, PdfPageSize, PdfPageTemplateElement, PdfPath, PdfPen, PdfRadialGradientBrush, PdfReference, PdfReferenceHolder, PdfResources, PdfSampledFunction, PdfSection, PdfSectionCollection, PdfSectionPageCollection, PdfSectionTemplate, PdfSolidBrush, PdfStandardFont, PdfStandardFontMetricsFactory, PdfStream, PdfStreamWriter, PdfString, PdfStringFormat, PdfStringLayoutResult, PdfStringLayouter, PdfSubSuperScript, PdfTemplate, PdfTextAlignment, PdfTextDirection, PdfTextElement, PdfTextLayoutResult, PdfTextWebLink, PdfTilingBrush, PdfTransformationMatrix, PdfTransparency, PdfTrueTypeFont, PdfUriAction, PdfUriAnnotation, PdfVerticalAlignment, PdfViewerPreferences, PdfWordWrapType, PdfWriter, PdfWriterHelper, PointF, ProcedureSets, Rectangle, RectangleF, RegisteredObject, RowLayoutResult, RtlCharacters, RtlRenderer, SaveAnnotationEventHandler, SaveCmapEventHandler, SaveDescendantFontEventHandler, SaveFontDictionaryEventHandler, SaveFontProgramEventHandler, SaveSectionCollectionEventHandler, SaveSectionEventHandler, SaveTemplateEventHandler, SizeF, StandardWidthTable, StringTokenizer, TemplateType, TextLayouter, TextPageLayoutResult, TextRenderingMode, TtfCmapEncoding, TtfCmapFormat, TtfCompositeGlyphFlags, TtfMacintoshEncodingID, TtfMicrosoftEncodingID, TtfPlatformID, WidthTable, _PdfChunkBuffer, defaultToString };
|
|
33059
33178
|
//# sourceMappingURL=ej2-pdf-export.es2015.js.map
|