Skip to content

crypto.getRandomValues must be defined #40

@yusifaliyevpro

Description

@yusifaliyevpro

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));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions