customTextRenderer does not work for text broken across textLayer items. #1735
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Thanks for the brilliant package. I'm not making this an issue, but I need help with how to implement text marking since I don't see how customTextRenderer can work for text that is broken up across textLayer items. Here is an example:
Using React-pdf, this text:


Is parsed into pieces in multiple elements like this:
So if I try to mark the text with a customTextRenderer like this:
({ str }) => str.replace(/multi-factor authentication/g, (value) => '<mark>${value}</mark>')
It will not work since the text is spread across multiple elements. Is there anyway to mark this text even though it's spread across multiple elements? In the live mozilla example they highlight it in parts:

but I don't know how they did that?
It seems like this PR may be helpful to this issue too: #1215
Beta Was this translation helpful? Give feedback.
All reactions