react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

Issue rendering borders with bun

Open francotrucco opened this issue 7 months ago • 2 comments

Describe the bug At work we use the library to create a dynamic receipt which in its styles has borders set, if we set the border without a unit with just border: 1 it fails to render but with no error, instead if we add the unit border: "1px" the problem is fixed. Previously we've been using node as runtime but some time ago migrated to bun.

To Reproduce Steps to reproduce the behavior including code snippet (if applies):

  1. Create an app with bun
  2. Create a Document with a View component with its styles containing a border without specifying the unit
  3. Use the PDFDownloadLink and pass your document

You can make use of react-pdf REPL to share the snippet

Expected behavior When link is clicked PDF is downloaded

Desktop (please complete the following information):

  • OS: macOS
  • Browser: all of them
  • React-pdf version: 4.2.2

francotrucco avatar Jun 06 '25 12:06 francotrucco

Since the latest versions, you need to specify the units, therefore, your styles

Before

<View
    style={{
        borderBottom: "1 solid #b50000",
    }}
>

After

<View
    style={{
        borderBottom: "1pt solid #b50000", // See the pt unit
    }}
>

Andres6936 avatar Jul 24 '25 23:07 Andres6936

@Andres6936 yap, that's the solution I described in the issue. Would you please update documentation to make it clear its required? The article you linked it says pts are the default but not specifying it makes it crash.

francotrucco avatar Jul 28 '25 15:07 francotrucco