wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.
https://projects.wojtekmaj.pl/react-pdf
MIT License
9.11k stars 867 forks source link

Give option to remove hyphen when text wraps to a new line #1679

Closed RichMatthews closed 6 months ago

RichMatthews commented 8 months ago

Before you start - checklist

Description

I have an issue when displaying an email in a pdf. when it wraps over to a new line it adds a hyphen. test@gmail.com becomes

test@gm-
ail.com

so now it looks like the email contains a - when of course, it does not.

how is this fixed in react-pdf? I don't immediately see any good solution.

Font.registerHyphenationCallback(word => {
  // Return entire word as unique part
  return [word];
});

doesn't seem to work as it applies it to all text but I just want it applied specifically to one string

Steps to reproduce

Render a string and cause it to wrap over multiple lines

Expected behavior

the option to at least say, do not show a hyphen

Actual behavior

it shows a hyphen

Additional information

No response

Environment

SunnySze0000 commented 6 months ago

+1

RichMatthews commented 6 months ago

@wojtekmaj any solution for this?

wojtekmaj commented 6 months ago

It looks like you confused React-PDF with @react-pdf/renderer. Please file an issue in their repo instead.