Property pdf does not exist on <Page>. Incorrect typings
See original GitHub issueBefore 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 Mozilla Firefox^ Not Applicable
Description
Short description of the bug you encountered.
According to docs its possible to pass a pdf
prop to a <Page>
component to render a page from an arbitrary pdfjs.PDFDocumentProxy
although typescript complains about this prop not existing.
I need this because I am trying to render pages from different pdfs together and multiple times so I don’t want duplicate Document
elements parsing the same pdf
Steps to reproduce
See below
Expected behavior
Typescript shouldn’t complain about typings
Additional information
<Page
pageIndex={pageIndex}
rotate={doc.representation[index].rotation}
pdf={ref as pdfjs.PDFDocumentProxy}
/>
Environment
- Browser (if applicable) [e.g. Chrome 57, Firefox 59]: N/A
- React-PDF version [e.g. 3.0.4]: 5.2.0
- React version [e.g. 16.3.0]: 17.0.2
- Webpack version (if applicable) [e.g. 4.16.2]: 4.39.1
- Typescript: 4.2.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Document and Page Typescript typings are missing a ...
As far as I can see is the issue that both Page and Document need a children property definition in PageProps and DocumentProps...
Read more >Typescript : Property does not exist on type 'object'
Property "country" doesn't exist on type "object". Is this a correct way to loop through each object in array and compare the object...
Read more >PDF form field properties, Adobe Acrobat
In Adobe Acrobat, how a form field behaves is determined by settings in the Properties dialog box for that individual field.
Read more >Issues Uploading Documents: Common Errors, Causes, ...
Overview. This article will help you diagnose and resolve common issues when uploading PDFs or other document types via the DocuSign web ...
Read more >Property does not exist on type '{}' in TypeScript
The "Property does not exist on type '{}'" error occurs when we try to access or set a property that is not contained...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this is a related but separate issue. Typescript is saying that the
pdf
prop doesn’t exist at all on the<Page>
component, not that the prop is the incorrect type.Property 'pdf' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Page> & Readonly<Props> & Readonly<{ children?: ReactNode; }>'.
pdfjs-dist changed their types so this is sort of expected. You can import the same types like this
import { PDFDocumentProxy } from 'pdfjs-dist/types/display/api';
However, apparently types in @types/react-pdf also have some bad references that look like they need to be patched