Appearance
Function: convertUint8ArrayToArrayBuffer()
ts
function convertUint8ArrayToArrayBuffer(uint8Array: Uint8Array): ArrayBuffer;Defined in: src/file/mwFile.ts:277
Convert a Uint8Array to a clean ArrayBuffer.
Slices the underlying buffer to guarantee a proper ArrayBuffer. Throws if the result is a SharedArrayBuffer.
Parameters
| Parameter | Type | Description |
|---|---|---|
uint8Array | Uint8Array | The Uint8Array to convert. |
Returns
ArrayBuffer
A standalone ArrayBuffer with the same byte content.
Example
ts
const pdfBytes = await pdfDoc.save();
const arrayBuffer = convertUint8ArrayToArrayBuffer(pdfBytes);
console.log(arrayBuffer.byteLength); // matches pdfBytes.length