@embedpdf/plugin-render 2.0.0-next.2 → 2.0.0-next.3
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/render-plugin.d.ts +2 -3
- package/dist/lib/types.d.ts +11 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),n=class extends e.BasePlugin{constructor(e,n,t){super(e,n),this.config=t}buildCapability(){return{renderPage:e=>this.renderPage(e),renderPageRect:e=>this.renderPageRect(e),forDocument:e=>this.createRenderScope(e)}}createRenderScope(e){return{renderPage:n=>this.renderPage(n,e),renderPageRect:n=>this.renderPageRect(n,e)}}renderPage({pageIndex:e,options:n},t){const i=t??this.getActiveDocumentId(),o=this.coreState.core.documents[i];if(!(null==o?void 0:o.document))throw new Error(`Document ${i} not loaded`);const r=o.document.pages.find(n=>n.index===e);if(!r)throw new Error(`Page ${e} not found in document ${i}`);const a={...n??{},withForms:(null==n?void 0:n.withForms)??this.config.withForms??!1,withAnnotations:(null==n?void 0:n.withAnnotations)??this.config.withAnnotations??!1,imageType:(null==n?void 0:n.imageType)??this.config.defaultImageType??"image/png",imageQuality:(null==n?void 0:n.imageQuality)??this.config.defaultImageQuality??.92};return this.engine.renderPage(o.document,r,a)}renderPageRect({pageIndex:e,rect:n,options:t},i){const o=i??this.getActiveDocumentId(),r=this.coreState.core.documents[o];if(!(null==r?void 0:r.document))throw new Error(`Document ${o} not loaded`);const a=r.document.pages.find(n=>n.index===e);if(!a)throw new Error(`Page ${e} not found in document ${o}`);const d={...t??{},withForms:(null==t?void 0:t.withForms)??this.config.withForms??!1,withAnnotations:(null==t?void 0:t.withAnnotations)??this.config.withAnnotations??!1,imageType:(null==t?void 0:t.imageType)??this.config.defaultImageType??"image/png",imageQuality:(null==t?void 0:t.imageQuality)??this.config.defaultImageQuality??.92};return this.engine.renderPageRect(r.document,a,n,d)}async initialize(e){this.logger.info("RenderPlugin","Initialize","Render plugin initialized")}async destroy(){super.destroy()}};n.id="render";let t=n;const i="render",o={manifest:{id:i,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{}},create:(e,n)=>new t(i,e,n),reducer:()=>{},initialState:{}};exports.RenderPlugin=t,exports.RenderPluginPackage=o;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/lib/render-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, PluginRegistry } from '@embedpdf/core';\nimport {\n RenderCapability,\n RenderPageOptions,\n RenderPageRectOptions,\n RenderPluginConfig,\n RenderScope,\n} from './types';\n\n/**\n * Render Plugin - Simplified version that relies on core state for refresh tracking\n *\n * Key insight: Page refresh tracking is in DocumentState.pageRefreshVersions\n * This allows ANY plugin to observe page refreshes, not just the render plugin.\n */\nexport class RenderPlugin extends BasePlugin<RenderPluginConfig, RenderCapability> {\n static readonly id = 'render' as const;\n\n private
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/lib/render-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, PluginRegistry } from '@embedpdf/core';\nimport {\n RenderCapability,\n RenderPageOptions,\n RenderPageRectOptions,\n RenderPluginConfig,\n RenderScope,\n} from './types';\n\n/**\n * Render Plugin - Simplified version that relies on core state for refresh tracking\n *\n * Key insight: Page refresh tracking is in DocumentState.pageRefreshVersions\n * This allows ANY plugin to observe page refreshes, not just the render plugin.\n */\nexport class RenderPlugin extends BasePlugin<RenderPluginConfig, RenderCapability> {\n static readonly id = 'render' as const;\n\n private config: RenderPluginConfig;\n\n constructor(id: string, registry: PluginRegistry, config: RenderPluginConfig) {\n super(id, registry);\n this.config = config;\n }\n\n // No onDocumentLoadingStarted or onDocumentClosed needed!\n\n protected buildCapability(): RenderCapability {\n return {\n // Active document operations\n renderPage: (options: RenderPageOptions) => this.renderPage(options),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createRenderScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createRenderScope(documentId: string): RenderScope {\n return {\n renderPage: (options: RenderPageOptions) => this.renderPage(options, documentId),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options, documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private renderPage({ pageIndex, options }: RenderPageOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.config.withForms ?? false,\n withAnnotations: options?.withAnnotations ?? this.config.withAnnotations ?? false,\n imageType: options?.imageType ?? this.config.defaultImageType ?? 'image/png',\n imageQuality: options?.imageQuality ?? this.config.defaultImageQuality ?? 0.92,\n };\n\n return this.engine.renderPage(coreDoc.document, page, mergedOptions);\n }\n\n private renderPageRect({ pageIndex, rect, options }: RenderPageRectOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.config.withForms ?? false,\n withAnnotations: options?.withAnnotations ?? this.config.withAnnotations ?? false,\n imageType: options?.imageType ?? this.config.defaultImageType ?? 'image/png',\n imageQuality: options?.imageQuality ?? this.config.defaultImageQuality ?? 0.92,\n };\n\n return this.engine.renderPageRect(coreDoc.document, page, rect, mergedOptions);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_config: RenderPluginConfig): Promise<void> {\n this.logger.info('RenderPlugin', 'Initialize', 'Render plugin initialized');\n }\n\n async destroy(): Promise<void> {\n super.destroy();\n }\n}\n","import { PluginManifest } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\n\nexport const RENDER_PLUGIN_ID = 'render';\n\nexport const manifest: PluginManifest<RenderPluginConfig> = {\n id: RENDER_PLUGIN_ID,\n name: 'Render Plugin',\n version: '1.0.0',\n provides: ['render'],\n requires: [],\n optional: [],\n defaultConfig: {},\n};\n","import { PluginPackage } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\nimport { RenderPlugin } from './render-plugin';\nimport { manifest, RENDER_PLUGIN_ID } from './manifest';\n\nexport const RenderPluginPackage: PluginPackage<RenderPlugin, RenderPluginConfig> = {\n manifest,\n create: (registry, config) => new RenderPlugin(RENDER_PLUGIN_ID, registry, config),\n reducer: () => {},\n initialState: {},\n};\n\nexport * from './render-plugin';\nexport * from './types';\n"],"names":["_RenderPlugin","BasePlugin","constructor","id","registry","config","super","this","buildCapability","renderPage","options","renderPageRect","forDocument","documentId","createRenderScope","pageIndex","getActiveDocumentId","coreDoc","coreState","core","documents","document","Error","page","pages","find","p","index","mergedOptions","withForms","withAnnotations","imageType","defaultImageType","imageQuality","defaultImageQuality","engine","rect","initialize","_config","logger","info","destroy","RenderPlugin","RENDER_PLUGIN_ID","RenderPluginPackage","manifest","name","version","provides","requires","optional","defaultConfig","create","reducer","initialState"],"mappings":"kHAeaA,EAAN,cAA2BC,EAAAA,WAKhC,WAAAC,CAAYC,EAAYC,EAA0BC,GAChDC,MAAMH,EAAIC,GACVG,KAAKF,OAASA,CAChB,CAIU,eAAAG,GACR,MAAO,CAELC,WAAaC,GAA+BH,KAAKE,WAAWC,GAC5DC,eAAiBD,GAAmCH,KAAKI,eAAeD,GAGxEE,YAAcC,GAAuBN,KAAKO,kBAAkBD,GAEhE,CAMQ,iBAAAC,CAAkBD,GACxB,MAAO,CACLJ,WAAaC,GAA+BH,KAAKE,WAAWC,EAASG,GACrEF,eAAiBD,GAAmCH,KAAKI,eAAeD,EAASG,GAErF,CAMQ,UAAAJ,EAAWM,UAAEA,EAAAL,QAAWA,GAA8BG,GAC5D,MAAMV,EAAKU,GAAcN,KAAKS,sBACxBC,EAAUV,KAAKW,UAAUC,KAAKC,UAAUjB,GAE9C,WAAKc,WAASI,UACZ,MAAM,IAAIC,MAAM,YAAYnB,gBAG9B,MAAMoB,EAAON,EAAQI,SAASG,MAAMC,KAAMC,GAAMA,EAAEC,QAAUZ,GAC5D,IAAKQ,EACH,MAAM,IAAID,MAAM,QAAQP,2BAAmCZ,KAG7D,MAAMyB,EAAgB,IAChBlB,GAAW,CAAA,EACfmB,WAAW,MAAAnB,OAAA,EAAAA,EAASmB,YAAatB,KAAKF,OAAOwB,YAAa,EAC1DC,iBAAiB,MAAApB,OAAA,EAAAA,EAASoB,kBAAmBvB,KAAKF,OAAOyB,kBAAmB,EAC5EC,WAAW,MAAArB,OAAA,EAAAA,EAASqB,YAAaxB,KAAKF,OAAO2B,kBAAoB,YACjEC,cAAc,MAAAvB,OAAA,EAAAA,EAASuB,eAAgB1B,KAAKF,OAAO6B,qBAAuB,KAG5E,OAAO3B,KAAK4B,OAAO1B,WAAWQ,EAAQI,SAAUE,EAAMK,EACxD,CAEQ,cAAAjB,EAAeI,UAA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class _RenderPlugin extends BasePlugin {
|
|
3
3
|
constructor(id, registry, config) {
|
|
4
4
|
super(id, registry);
|
|
5
|
-
this.
|
|
6
|
-
this.withAnnotations = false;
|
|
7
|
-
this.withForms = (config == null ? void 0 : config.withForms) ?? false;
|
|
8
|
-
this.withAnnotations = (config == null ? void 0 : config.withAnnotations) ?? false;
|
|
5
|
+
this.config = config;
|
|
9
6
|
}
|
|
10
7
|
// No onDocumentLoadingStarted or onDocumentClosed needed!
|
|
11
8
|
buildCapability() {
|
|
@@ -41,8 +38,10 @@ const _RenderPlugin = class _RenderPlugin extends BasePlugin {
|
|
|
41
38
|
}
|
|
42
39
|
const mergedOptions = {
|
|
43
40
|
...options ?? {},
|
|
44
|
-
withForms: (options == null ? void 0 : options.withForms) ?? this.withForms,
|
|
45
|
-
withAnnotations: (options == null ? void 0 : options.withAnnotations) ?? this.withAnnotations
|
|
41
|
+
withForms: (options == null ? void 0 : options.withForms) ?? this.config.withForms ?? false,
|
|
42
|
+
withAnnotations: (options == null ? void 0 : options.withAnnotations) ?? this.config.withAnnotations ?? false,
|
|
43
|
+
imageType: (options == null ? void 0 : options.imageType) ?? this.config.defaultImageType ?? "image/png",
|
|
44
|
+
imageQuality: (options == null ? void 0 : options.imageQuality) ?? this.config.defaultImageQuality ?? 0.92
|
|
46
45
|
};
|
|
47
46
|
return this.engine.renderPage(coreDoc.document, page, mergedOptions);
|
|
48
47
|
}
|
|
@@ -58,8 +57,10 @@ const _RenderPlugin = class _RenderPlugin extends BasePlugin {
|
|
|
58
57
|
}
|
|
59
58
|
const mergedOptions = {
|
|
60
59
|
...options ?? {},
|
|
61
|
-
withForms: (options == null ? void 0 : options.withForms) ?? this.withForms,
|
|
62
|
-
withAnnotations: (options == null ? void 0 : options.withAnnotations) ?? this.withAnnotations
|
|
60
|
+
withForms: (options == null ? void 0 : options.withForms) ?? this.config.withForms ?? false,
|
|
61
|
+
withAnnotations: (options == null ? void 0 : options.withAnnotations) ?? this.config.withAnnotations ?? false,
|
|
62
|
+
imageType: (options == null ? void 0 : options.imageType) ?? this.config.defaultImageType ?? "image/png",
|
|
63
|
+
imageQuality: (options == null ? void 0 : options.imageQuality) ?? this.config.defaultImageQuality ?? 0.92
|
|
63
64
|
};
|
|
64
65
|
return this.engine.renderPageRect(coreDoc.document, page, rect, mergedOptions);
|
|
65
66
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/lib/render-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, PluginRegistry } from '@embedpdf/core';\nimport {\n RenderCapability,\n RenderPageOptions,\n RenderPageRectOptions,\n RenderPluginConfig,\n RenderScope,\n} from './types';\n\n/**\n * Render Plugin - Simplified version that relies on core state for refresh tracking\n *\n * Key insight: Page refresh tracking is in DocumentState.pageRefreshVersions\n * This allows ANY plugin to observe page refreshes, not just the render plugin.\n */\nexport class RenderPlugin extends BasePlugin<RenderPluginConfig, RenderCapability> {\n static readonly id = 'render' as const;\n\n private
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/lib/render-plugin.ts","../src/lib/manifest.ts","../src/lib/index.ts"],"sourcesContent":["import { BasePlugin, PluginRegistry } from '@embedpdf/core';\nimport {\n RenderCapability,\n RenderPageOptions,\n RenderPageRectOptions,\n RenderPluginConfig,\n RenderScope,\n} from './types';\n\n/**\n * Render Plugin - Simplified version that relies on core state for refresh tracking\n *\n * Key insight: Page refresh tracking is in DocumentState.pageRefreshVersions\n * This allows ANY plugin to observe page refreshes, not just the render plugin.\n */\nexport class RenderPlugin extends BasePlugin<RenderPluginConfig, RenderCapability> {\n static readonly id = 'render' as const;\n\n private config: RenderPluginConfig;\n\n constructor(id: string, registry: PluginRegistry, config: RenderPluginConfig) {\n super(id, registry);\n this.config = config;\n }\n\n // No onDocumentLoadingStarted or onDocumentClosed needed!\n\n protected buildCapability(): RenderCapability {\n return {\n // Active document operations\n renderPage: (options: RenderPageOptions) => this.renderPage(options),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options),\n\n // Document-scoped operations\n forDocument: (documentId: string) => this.createRenderScope(documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Document Scoping\n // ─────────────────────────────────────────────────────────\n\n private createRenderScope(documentId: string): RenderScope {\n return {\n renderPage: (options: RenderPageOptions) => this.renderPage(options, documentId),\n renderPageRect: (options: RenderPageRectOptions) => this.renderPageRect(options, documentId),\n };\n }\n\n // ─────────────────────────────────────────────────────────\n // Core Operations\n // ─────────────────────────────────────────────────────────\n\n private renderPage({ pageIndex, options }: RenderPageOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.config.withForms ?? false,\n withAnnotations: options?.withAnnotations ?? this.config.withAnnotations ?? false,\n imageType: options?.imageType ?? this.config.defaultImageType ?? 'image/png',\n imageQuality: options?.imageQuality ?? this.config.defaultImageQuality ?? 0.92,\n };\n\n return this.engine.renderPage(coreDoc.document, page, mergedOptions);\n }\n\n private renderPageRect({ pageIndex, rect, options }: RenderPageRectOptions, documentId?: string) {\n const id = documentId ?? this.getActiveDocumentId();\n const coreDoc = this.coreState.core.documents[id];\n\n if (!coreDoc?.document) {\n throw new Error(`Document ${id} not loaded`);\n }\n\n const page = coreDoc.document.pages.find((p) => p.index === pageIndex);\n if (!page) {\n throw new Error(`Page ${pageIndex} not found in document ${id}`);\n }\n\n const mergedOptions = {\n ...(options ?? {}),\n withForms: options?.withForms ?? this.config.withForms ?? false,\n withAnnotations: options?.withAnnotations ?? this.config.withAnnotations ?? false,\n imageType: options?.imageType ?? this.config.defaultImageType ?? 'image/png',\n imageQuality: options?.imageQuality ?? this.config.defaultImageQuality ?? 0.92,\n };\n\n return this.engine.renderPageRect(coreDoc.document, page, rect, mergedOptions);\n }\n\n // ─────────────────────────────────────────────────────────\n // Lifecycle\n // ─────────────────────────────────────────────────────────\n\n async initialize(_config: RenderPluginConfig): Promise<void> {\n this.logger.info('RenderPlugin', 'Initialize', 'Render plugin initialized');\n }\n\n async destroy(): Promise<void> {\n super.destroy();\n }\n}\n","import { PluginManifest } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\n\nexport const RENDER_PLUGIN_ID = 'render';\n\nexport const manifest: PluginManifest<RenderPluginConfig> = {\n id: RENDER_PLUGIN_ID,\n name: 'Render Plugin',\n version: '1.0.0',\n provides: ['render'],\n requires: [],\n optional: [],\n defaultConfig: {},\n};\n","import { PluginPackage } from '@embedpdf/core';\nimport { RenderPluginConfig } from './types';\nimport { RenderPlugin } from './render-plugin';\nimport { manifest, RENDER_PLUGIN_ID } from './manifest';\n\nexport const RenderPluginPackage: PluginPackage<RenderPlugin, RenderPluginConfig> = {\n manifest,\n create: (registry, config) => new RenderPlugin(RENDER_PLUGIN_ID, registry, config),\n reducer: () => {},\n initialState: {},\n};\n\nexport * from './render-plugin';\nexport * from './types';\n"],"names":[],"mappings":";AAeO,MAAM,gBAAN,MAAM,sBAAqB,WAAiD;AAAA,EAKjF,YAAY,IAAY,UAA0B,QAA4B;AAC5E,UAAM,IAAI,QAAQ;AAClB,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA,EAIU,kBAAoC;AAC5C,WAAO;AAAA;AAAA,MAEL,YAAY,CAAC,YAA+B,KAAK,WAAW,OAAO;AAAA,MACnE,gBAAgB,CAAC,YAAmC,KAAK,eAAe,OAAO;AAAA;AAAA,MAG/E,aAAa,CAAC,eAAuB,KAAK,kBAAkB,UAAU;AAAA,IAAA;AAAA,EAE1E;AAAA;AAAA;AAAA;AAAA,EAMQ,kBAAkB,YAAiC;AACzD,WAAO;AAAA,MACL,YAAY,CAAC,YAA+B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BAA0B,EAAE,EAAE;AAAA,IACjE;AAEA,UAAM,gBAAgB;AAAA,MACpB,GAAI,WAAW,CAAA;AAAA,MACf,YAAW,mCAAS,cAAa,KAAK,OAAO,aAAa;AAAA,MAC1D,kBAAiB,mCAAS,oBAAmB,KAAK,OAAO,mBAAmB;AAAA,MAC5E,YAAW,mCAAS,cAAa,KAAK,OAAO,oBAAoB;AAAA,MACjE,eAAc,mCAAS,iBAAgB,KAAK,OAAO,uBAAuB;AAAA,IAAA;AAG5E,WAAO,KAAK,OAAO,eAAe,QAAQ,UAAU,MAAM,MAAM,aAAa;AAAA,EAC/E;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,WAAW,SAA4C;AAC3D,SAAK,OAAO,KAAK,gBAAgB,cAAc,2BAA2B;AAAA,EAC5E;AAAA,EAEA,MAAM,UAAyB;AAC7B,UAAM,QAAA;AAAA,EACR;AACF;AAhGE,cAAgB,KAAK;AADhB,IAAM,eAAN;ACZA,MAAM,mBAAmB;AAEzB,MAAM,WAA+C;AAAA,EAC1D,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU,CAAC,QAAQ;AAAA,EACnB,UAAU,CAAA;AAAA,EACV,UAAU,CAAA;AAAA,EACV,eAAe,CAAA;AACjB;ACRO,MAAM,sBAAuE;AAAA,EAClF;AAAA,EACA,QAAQ,CAAC,UAAU,WAAW,IAAI,aAAa,kBAAkB,UAAU,MAAM;AAAA,EACjF,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,cAAc,CAAA;AAChB;"}
|
|
@@ -8,9 +8,8 @@ import { RenderCapability, RenderPluginConfig } from './types';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class RenderPlugin extends BasePlugin<RenderPluginConfig, RenderCapability> {
|
|
10
10
|
static readonly id: "render";
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
constructor(id: string, registry: PluginRegistry, config?: RenderPluginConfig);
|
|
11
|
+
private config;
|
|
12
|
+
constructor(id: string, registry: PluginRegistry, config: RenderPluginConfig);
|
|
14
13
|
protected buildCapability(): RenderCapability;
|
|
15
14
|
private createRenderScope;
|
|
16
15
|
private renderPage;
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BasePluginConfig } from '@embedpdf/core';
|
|
2
|
-
import { PdfErrorReason, PdfRenderPageOptions, Rect, Task } from '@embedpdf/models';
|
|
2
|
+
import { ImageConversionTypes, PdfErrorReason, PdfRenderPageOptions, Rect, Task } from '@embedpdf/models';
|
|
3
3
|
export interface RenderPluginConfig extends BasePluginConfig {
|
|
4
4
|
/**
|
|
5
5
|
* Initialize and draw form widgets during renders.
|
|
@@ -11,6 +11,16 @@ export interface RenderPluginConfig extends BasePluginConfig {
|
|
|
11
11
|
* Defaults to `false`.
|
|
12
12
|
*/
|
|
13
13
|
withAnnotations?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The image type to use for rendering.
|
|
16
|
+
* Defaults to `'image/webp'`.
|
|
17
|
+
*/
|
|
18
|
+
defaultImageType?: ImageConversionTypes;
|
|
19
|
+
/**
|
|
20
|
+
* The image quality to use for rendering.
|
|
21
|
+
* Defaults to `0.92`.
|
|
22
|
+
*/
|
|
23
|
+
defaultImageQuality?: number;
|
|
14
24
|
}
|
|
15
25
|
export interface RenderPageRectOptions {
|
|
16
26
|
pageIndex: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-render",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@embedpdf/models": "2.0.0-next.
|
|
38
|
+
"@embedpdf/models": "2.0.0-next.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/react": "^18.2.0",
|
|
42
42
|
"typescript": "^5.0.0",
|
|
43
43
|
"@embedpdf/build": "1.1.0",
|
|
44
|
-
"@embedpdf/core": "2.0.0-next.
|
|
44
|
+
"@embedpdf/core": "2.0.0-next.3"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"preact": "^10.26.4",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-dom": ">=16.8.0",
|
|
50
50
|
"vue": ">=3.2.0",
|
|
51
51
|
"svelte": ">=5 <6",
|
|
52
|
-
"@embedpdf/core": "2.0.0-next.
|
|
52
|
+
"@embedpdf/core": "2.0.0-next.3"
|
|
53
53
|
},
|
|
54
54
|
"files": [
|
|
55
55
|
"dist",
|