Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting by rectangle bounds and not text #979

Closed
4 tasks done
gla5001 opened this issue Apr 8, 2022 · 1 comment
Closed
4 tasks done

Highlighting by rectangle bounds and not text #979

gla5001 opened this issue Apr 8, 2022 · 1 comment
Labels
question Further information is requested

Comments

@gla5001
Copy link

gla5001 commented Apr 8, 2022

Before you start - checklist

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

Description

I've tried the recipe for highlighting text here. It works fairly well, but it does not work with multiple lines. Lets say I know the bounds of a rectangle on a specified page (or I know multiple bounds), ie

bottom: 649.4013
left: 261.64355
right: 340.28177
top: 661.1968

Is there a way to highlight by these bounds instead of matching text?

Steps to reproduce

n/a

Expected behavior

n/a

Actual behavior

n/a

Additional information

This isnt a bug, just a question

Environment

  • Browser (if applicable):
  • React-PDF version:
  • React version:
  • Webpack version (if applicable):
@gla5001 gla5001 added the bug Something isn't working label Apr 8, 2022
@wojtekmaj
Copy link
Owner

You can use canvasRef prop to draw whatever you want on a given canvas. Here's an example with watermark added dynamically, but should be able to figure out how to draw anything else.

https://codesandbox.io/s/react-pdf-watermark-5wylx?file=/src/index.jsx

@wojtekmaj wojtekmaj added question Further information is requested and removed bug Something isn't working labels Apr 10, 2022
Repository owner locked and limited conversation to collaborators Apr 10, 2022
@wojtekmaj wojtekmaj converted this issue into discussion #980 Apr 10, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants