@embedpdf/engine-services 3.0.0-next.5 → 3.0.0-next.6
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/index.cjs +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4172,6 +4172,14 @@ const BOX_FAMILY_SUBTYPES = /* @__PURE__ */ new Set([
|
|
|
4172
4172
|
14
|
|
4173
4173
|
]);
|
|
4174
4174
|
/**
|
|
4175
|
+
* Per-appearance output-pixel ceiling (see the clamp in `renderOne`).
|
|
4176
|
+
* 16 M px ≈ a 4000² raster ≈ 64 MB of transient RGBA — safely inside the
|
|
4177
|
+
* wasm heap for the one-at-a-time batch loop, while a page-sized annotation
|
|
4178
|
+
* stays crisp to roughly 5–6× before its appearance starts stretching.
|
|
4179
|
+
* Small annotations (the overwhelming majority) never come near it.
|
|
4180
|
+
*/
|
|
4181
|
+
const APPEARANCE_PIXEL_CLAMP = 16e6;
|
|
4182
|
+
/**
|
|
4175
4183
|
* Maps an `AnnotationAppearanceMode` onto the PDFium appearance-mode int and
|
|
4176
4184
|
* the `EPDFAnnot_GetAvailableAppearanceModes` bit it occupies.
|
|
4177
4185
|
* N -> mode 0 / bit 1, R -> mode 1 / bit 2, D -> mode 2 / bit 4.
|
|
@@ -4270,13 +4278,15 @@ var AnnotationAppearanceReader = class {
|
|
|
4270
4278
|
fn.EPDFAnnot_GenerateFormFieldAP(annotPtr);
|
|
4271
4279
|
if (!fn.EPDFAnnot_HasAppearanceStream(annotPtr, modeInt)) return null;
|
|
4272
4280
|
} else return null;
|
|
4281
|
+
const rectArea = Math.max(1, (rect.right - rect.left) * (rect.top - rect.bottom));
|
|
4282
|
+
const effScale = Math.min(scale, Math.sqrt(APPEARANCE_PIXEL_CLAMP / rectArea));
|
|
4273
4283
|
return rasterize(this.runtime, {
|
|
4274
4284
|
rect,
|
|
4275
4285
|
page,
|
|
4276
4286
|
rotation,
|
|
4277
4287
|
viewport: {
|
|
4278
4288
|
kind: "scale",
|
|
4279
|
-
scale
|
|
4289
|
+
scale: effScale
|
|
4280
4290
|
},
|
|
4281
4291
|
...maxOutputPixels !== void 0 ? { maxOutputPixels } : {},
|
|
4282
4292
|
background: "transparent",
|