Skip to content

How to prevent boundsOfString to create new page #1625

@raman-nbg

Description

@raman-nbg

Question

Description

I am using boundsOfString(...) to calculate the bounds of a string to ensure it fits on the current page. Unfortunately calling this function creates a new page if the text doesn't fit on the page.

How can I prevent a new page to be created?

Code sample

doc.boundsOfString("some long text ... ");

Your environment

  • pdfkit version: 0.17.1
  • Node version: 22.14
  • Browser version (if applicable): (running on node)
  • Operating System: macos

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