This works on Windows, but there’s a problem on macOS. Only way to fix that is to assign "crypto" before calling @libpdf/core functions.
if (isMac) {
const { webcrypto } = await import("crypto");
if (!("crypto" in globalThis)) Object.assign(globalThis, { crypto: webcrypto });
const pdf = await PDF.load(new Uint8Array(pdfBytes));