Skip to content

Document renders blank when re-opened with the same ID after closeDocument #439

@ivaylostefanov97

Description

@ivaylostefanov97

When a document is closed via closeDocument() and then re-opened with openDocumentUrl() using the same documentId, the document appears blank — scrollable space is present (as if pages exist) but nothing is rendered.

Steps to reproduce:

  1. Open a document with a given ID (e.g. "doc-1")
  2. Close it with docManager.closeDocument("doc-1")
  3. Wait for DocumentClosed event
  4. Re-open with docManager.openDocumentUrl({ url: "...", documentId: "doc-1" })

Expected: Document opens and renders normally, same as the first time.

Actual: OpenDocumentBuffer succeeds, DocumentOpened fires, but pages render blank. The scroll area reflects the correct page count/dimensions but no page content is painted.

Environment:
@embedpdf/*: 2.4.1
Browser: Chrome (latest)

Notes:

Waiting an arbitrary amount of time (15+ seconds) between close and re-open does not help — this is not a timing/race condition.
The first open with the same ID always works. Only subsequent opens after a close are affected.
Using a different documentId for the re-open works around the issue.

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