@embedpdf/engines 2.6.1 → 2.6.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/direct-engine-CCVjfywm.cjs +2 -0
- package/dist/direct-engine-CCVjfywm.cjs.map +1 -0
- package/dist/{direct-engine-BmntIHbH.js → direct-engine-CmsmBgWP.js} +73 -7
- package/dist/direct-engine-CmsmBgWP.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/pdfium/index.cjs +1 -1
- package/dist/lib/pdfium/index.js +2 -2
- package/dist/lib/pdfium/web/direct-engine.cjs +1 -1
- package/dist/lib/pdfium/web/direct-engine.js +1 -1
- package/dist/lib/pdfium/web/worker-engine.cjs +1 -1
- package/dist/lib/pdfium/web/worker-engine.js +1 -1
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.js +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.js +1 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.js +1 -1
- package/package.json +4 -4
- package/dist/direct-engine-BaKyNZkO.cjs +0 -2
- package/dist/direct-engine-BaKyNZkO.cjs.map +0 -1
- package/dist/direct-engine-BmntIHbH.js.map +0 -1
|
@@ -3732,7 +3732,8 @@ class PdfiumNative {
|
|
|
3732
3732
|
height: g.size.height
|
|
3733
3733
|
},
|
|
3734
3734
|
charStart: i,
|
|
3735
|
-
glyphs: []
|
|
3735
|
+
glyphs: [],
|
|
3736
|
+
fontSize: this.pdfiumModule.FPDFText_GetFontSize(textPagePtr, i)
|
|
3736
3737
|
};
|
|
3737
3738
|
bounds = {
|
|
3738
3739
|
minX: g.origin.x,
|
|
@@ -3747,7 +3748,9 @@ class PdfiumNative {
|
|
|
3747
3748
|
y: g.origin.y,
|
|
3748
3749
|
width: g.size.width,
|
|
3749
3750
|
height: g.size.height,
|
|
3750
|
-
flags: g.isEmpty ? 2 : g.isSpace ? 1 : 0
|
|
3751
|
+
flags: g.isEmpty ? 2 : g.isSpace ? 1 : 0,
|
|
3752
|
+
...g.tightOrigin && { tightX: g.tightOrigin.x, tightY: g.tightOrigin.y },
|
|
3753
|
+
...g.tightSize && { tightWidth: g.tightSize.width, tightHeight: g.tightSize.height }
|
|
3751
3754
|
});
|
|
3752
3755
|
if (g.isEmpty) {
|
|
3753
3756
|
continue;
|
|
@@ -3959,14 +3962,31 @@ class PdfiumNative {
|
|
|
3959
3962
|
const dx2Ptr = this.memoryManager.malloc(4);
|
|
3960
3963
|
const dy2Ptr = this.memoryManager.malloc(4);
|
|
3961
3964
|
const rectPtr = this.memoryManager.malloc(16);
|
|
3965
|
+
const tLeftPtr = this.memoryManager.malloc(8);
|
|
3966
|
+
const tRightPtr = this.memoryManager.malloc(8);
|
|
3967
|
+
const tBottomPtr = this.memoryManager.malloc(8);
|
|
3968
|
+
const tTopPtr = this.memoryManager.malloc(8);
|
|
3969
|
+
const allPtrs = [
|
|
3970
|
+
rectPtr,
|
|
3971
|
+
dx1Ptr,
|
|
3972
|
+
dy1Ptr,
|
|
3973
|
+
dx2Ptr,
|
|
3974
|
+
dy2Ptr,
|
|
3975
|
+
tLeftPtr,
|
|
3976
|
+
tRightPtr,
|
|
3977
|
+
tBottomPtr,
|
|
3978
|
+
tTopPtr
|
|
3979
|
+
];
|
|
3962
3980
|
let x = 0, y = 0, width = 0, height = 0, isSpace = false;
|
|
3981
|
+
let tightOrigin;
|
|
3982
|
+
let tightSize;
|
|
3963
3983
|
if (this.pdfiumModule.FPDFText_GetLooseCharBox(textPagePtr, charIndex, rectPtr)) {
|
|
3964
3984
|
const left = this.pdfiumModule.pdfium.getValue(rectPtr, "float");
|
|
3965
3985
|
const top = this.pdfiumModule.pdfium.getValue(rectPtr + 4, "float");
|
|
3966
3986
|
const right = this.pdfiumModule.pdfium.getValue(rectPtr + 8, "float");
|
|
3967
3987
|
const bottom = this.pdfiumModule.pdfium.getValue(rectPtr + 12, "float");
|
|
3968
3988
|
if (left === right || top === bottom) {
|
|
3969
|
-
|
|
3989
|
+
allPtrs.forEach((p) => this.memoryManager.free(p));
|
|
3970
3990
|
return {
|
|
3971
3991
|
origin: { x: 0, y: 0 },
|
|
3972
3992
|
size: { width: 0, height: 0 },
|
|
@@ -3979,7 +3999,6 @@ class PdfiumNative {
|
|
|
3979
3999
|
0,
|
|
3980
4000
|
page.size.width,
|
|
3981
4001
|
page.size.height,
|
|
3982
|
-
/*rotate=*/
|
|
3983
4002
|
0,
|
|
3984
4003
|
left,
|
|
3985
4004
|
top,
|
|
@@ -3992,7 +4011,6 @@ class PdfiumNative {
|
|
|
3992
4011
|
0,
|
|
3993
4012
|
page.size.width,
|
|
3994
4013
|
page.size.height,
|
|
3995
|
-
/*rotate=*/
|
|
3996
4014
|
0,
|
|
3997
4015
|
right,
|
|
3998
4016
|
bottom,
|
|
@@ -4007,13 +4025,61 @@ class PdfiumNative {
|
|
|
4007
4025
|
y = Math.min(y1, y2);
|
|
4008
4026
|
width = Math.max(1, Math.abs(x2 - x1));
|
|
4009
4027
|
height = Math.max(1, Math.abs(y2 - y1));
|
|
4028
|
+
if (this.pdfiumModule.FPDFText_GetCharBox(
|
|
4029
|
+
textPagePtr,
|
|
4030
|
+
charIndex,
|
|
4031
|
+
tLeftPtr,
|
|
4032
|
+
tRightPtr,
|
|
4033
|
+
tBottomPtr,
|
|
4034
|
+
tTopPtr
|
|
4035
|
+
)) {
|
|
4036
|
+
const tLeft = this.pdfiumModule.pdfium.getValue(tLeftPtr, "double");
|
|
4037
|
+
const tRight = this.pdfiumModule.pdfium.getValue(tRightPtr, "double");
|
|
4038
|
+
const tBottom = this.pdfiumModule.pdfium.getValue(tBottomPtr, "double");
|
|
4039
|
+
const tTop = this.pdfiumModule.pdfium.getValue(tTopPtr, "double");
|
|
4040
|
+
this.pdfiumModule.FPDF_PageToDevice(
|
|
4041
|
+
pagePtr,
|
|
4042
|
+
0,
|
|
4043
|
+
0,
|
|
4044
|
+
page.size.width,
|
|
4045
|
+
page.size.height,
|
|
4046
|
+
0,
|
|
4047
|
+
tLeft,
|
|
4048
|
+
tTop,
|
|
4049
|
+
dx1Ptr,
|
|
4050
|
+
dy1Ptr
|
|
4051
|
+
);
|
|
4052
|
+
this.pdfiumModule.FPDF_PageToDevice(
|
|
4053
|
+
pagePtr,
|
|
4054
|
+
0,
|
|
4055
|
+
0,
|
|
4056
|
+
page.size.width,
|
|
4057
|
+
page.size.height,
|
|
4058
|
+
0,
|
|
4059
|
+
tRight,
|
|
4060
|
+
tBottom,
|
|
4061
|
+
dx2Ptr,
|
|
4062
|
+
dy2Ptr
|
|
4063
|
+
);
|
|
4064
|
+
const tx1 = this.pdfiumModule.pdfium.getValue(dx1Ptr, "i32");
|
|
4065
|
+
const ty1 = this.pdfiumModule.pdfium.getValue(dy1Ptr, "i32");
|
|
4066
|
+
const tx2 = this.pdfiumModule.pdfium.getValue(dx2Ptr, "i32");
|
|
4067
|
+
const ty2 = this.pdfiumModule.pdfium.getValue(dy2Ptr, "i32");
|
|
4068
|
+
tightOrigin = { x: Math.min(tx1, tx2), y: Math.min(ty1, ty2) };
|
|
4069
|
+
tightSize = {
|
|
4070
|
+
width: Math.max(1, Math.abs(tx2 - tx1)),
|
|
4071
|
+
height: Math.max(1, Math.abs(ty2 - ty1))
|
|
4072
|
+
};
|
|
4073
|
+
}
|
|
4010
4074
|
const uc = this.pdfiumModule.FPDFText_GetUnicode(textPagePtr, charIndex);
|
|
4011
4075
|
isSpace = uc === 32;
|
|
4012
4076
|
}
|
|
4013
|
-
|
|
4077
|
+
allPtrs.forEach((p) => this.memoryManager.free(p));
|
|
4014
4078
|
return {
|
|
4015
4079
|
origin: { x, y },
|
|
4016
4080
|
size: { width, height },
|
|
4081
|
+
...tightOrigin && { tightOrigin },
|
|
4082
|
+
...tightSize && { tightSize },
|
|
4017
4083
|
...isSpace && { isSpace }
|
|
4018
4084
|
};
|
|
4019
4085
|
}
|
|
@@ -8198,4 +8264,4 @@ export {
|
|
|
8198
8264
|
isValidCustomKey as i,
|
|
8199
8265
|
readArrayBuffer as r
|
|
8200
8266
|
};
|
|
8201
|
-
//# sourceMappingURL=direct-engine-
|
|
8267
|
+
//# sourceMappingURL=direct-engine-CmsmBgWP.js.map
|