wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.

Home Page:https://projects.wojtekmaj.pl/react-pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Annotation Layer redering issue

juancarlos-cynch opened this issue · comments

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

When opening a PDF file with annotated info, the values are being shown misaligned.
I'm seeing this issue even in the library demos.

  • Using the react-pdf library:
    Screenshot 2024-03-08 at 09 55 45

  • Using any other PDF reader software:
    Screenshot 2024-03-08 at 09 55 00

Steps to reproduce

  1. Clone the react-pdf library
  2. Go to sample/vite/ folder and install the demo dependencies npm install
  3. Run the demo: npm run dev
  4. Choose the attached file in this issue, using the file selector and load a PDF file with annotations.
  5. See the misaligned data and compare opening the file with another PDF reader (like Mac Preview)

Expected behavior

The form values should be showed correctly aligned as any other PDF reader software.

Actual behavior

The form values are incorrectly aligned.

Additional information

Sample Demo: https://github.com/wojtekmaj/react-pdf/tree/main/sample/vite

Test File: f1040--2022 (1).pdf

Environment

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

I am also getting similar issues:-
PIC 1:- when selecting/clicking on hyperlinks, the layers are not alined with the original PDF text.
1ex

PIC 2:- original PDF.
2ex

Environment:-

  • React version: 17
  • React-PDF version: latest

import 'react-pdf/dist/Page/TextLayer.css';
import 'react-pdf/dist/Page/AnnotationLayer.css';

you can import this two css which solved the issue but not sure where its good idea or not