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

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

Open RichMatthews opened this issue 1 year ago • 4 comments

Before you start - checklist

  • [X] I followed instructions in documentation written for my React-PDF version
  • [X] I have checked if this bug is not already reported
  • [X] I have checked if an issue is not listed in Known issues
  • [X] If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

I have an issue when displaying an email in a pdf. when it wraps over to a new line it adds a hyphen. [email protected] 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

  • Browser (if applicable):
  • React-PDF version:
  • React version:
  • Webpack version (if applicable):

RichMatthews avatar Jan 25 '24 16:01 RichMatthews

Upvoting the issue

@diegomura @RichMatthews have you found any workaround?

Hatko avatar Feb 16 '24 10:02 Hatko

i would like to know that as well please :)

MasterRedStorm avatar Apr 24 '24 08:04 MasterRedStorm

@Hatko not a good one yet unfortunately.

RichMatthews avatar Apr 24 '24 08:04 RichMatthews