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.24k stars 877 forks source link

Create sections within pdf using custom HTML tags and classes or ids #1610

Closed manishPh closed 8 months ago

manishPh commented 11 months ago

Before you start - checklist

Description

I'd like to add a feature to create sections within pdf document. For example, in the tax form PDF, you can clearly create sections around, personal details, deductions details, income details etc.

Proposed solution

That means wrapping a section of generated html tags with something like

<div class="personal-details">
<span>...</span>
<span>...</span>
<span>...</span>
</div>

I am not clear on using customTextRenderer prop for <Page /> because it gets each and every string that can be modified. But not sure how to accumulate strings and then wrap them with a <div> tag with specific class to "create" sections. I hope I'm able to explain the problem.

Usage: Create a guided tour within rendered pdf with sections using packages like reactour or joyride to guide users through different sections for better explanations.

Alternatives

n/a

Additional information

Screenshot 2023-09-20 at 1 38 31 PM

manishPh commented 11 months ago

In the above screenshot, I was able to add a div tag with class around a the string Caution using customTextRenderer prop but ideally I would like to add a div tag around section say fields (in the tax form) from 22a to 27 and add className like tax-payments-details.

manishPh commented 11 months ago

@wojtekmaj any pointers would be appreciated 👍

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

github-actions[bot] commented 8 months ago

This issue was closed because it has been stalled for 14 days with no activity.