Disposable
Defined in: src/core/disposable.ts:141
Base class for disposable PDFium resources.
Provides automatic cleanup support through ES2024’s explicit resource management (Symbol.dispose) and a FinalizationRegistry safety net.
Example
Section titled “Example”// Automatic cleanup with 'using' keyword{ using doc = await pdfium.openDocument(bytes); // Work with document} // Automatically disposed here
// Manual cleanupconst doc = await pdfium.openDocument(bytes);try { // Work with document} finally { doc.dispose();}Extends
Section titled “Extends”DisposableBase
Extended by
Section titled “Extended by”PDFiumAnnotationPDFiumDocumentBuilderPDFiumPageBuilderPDFiumDocumentPDFiumFontNativePDFiumDocumentNativePDFiumInstanceNativePDFiumPagePDFiumPageProgressivePDFLoaderProgressiveRenderContextPDFium
Implements
Section titled “Implements”Disposable
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Disposable(
resourceName,disposedErrorCode):Disposable
Defined in: src/core/disposable.ts:62
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
resourceName | string | undefined |
disposedErrorCode | PDFiumErrorCode | PDFiumErrorCode.RESOURCE_DISPOSED |
Returns
Section titled “Returns”Disposable
Inherited from
Section titled “Inherited from”DisposableBase.constructor
Accessors
Section titled “Accessors”disposed
Section titled “disposed”Get Signature
Section titled “Get Signature”get disposed():
boolean
Defined in: src/core/disposable.ts:73
Whether this resource has been disposed.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”DisposableBase.disposed
Methods
Section titled “Methods”[dispose]()
Section titled “[dispose]()”[dispose]():
void
Defined in: src/core/disposable.ts:148
Dispose of this resource, freeing WASM memory.
This method is idempotent - calling it multiple times has no effect after the first call.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”globalThis.Disposable.[dispose]
dispose()
Section titled “dispose()”dispose():
void
Defined in: src/core/disposable.ts:164
Alias for Symbol.dispose for explicit calls.
Returns
Section titled “Returns”void
Example
Section titled “Example”document.dispose();