question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Any document rendered in browser with iframe (from BlobProvider or PDFViewer) is empty

See original GitHub issue

OS: Mac OS 10.41.1

React-pdf version: 1.0.0-alpha.25

Description: None of the generated iFrames are filled with the output. This happens both in the render process in an Electron app (should be the same as a web environment), and on codesandbox with the same behaviour (can be seen in sandbox, url below).

When generating a download link the resulting PDF is generated correctly, but in the case of iFrames they seem to be empty: image

Codesandbox example: https://codesandbox.io/s/nk6k26x2rj

This is an issue since I imagine that if we want to do something like in the REPL where you can edit the pdf on the fly you need to show it in an iFrame, in order to maintain the aspect ratio, layout etc which should be fixed to the PDF, and not to the viewport. Rendering the <Document /> component in the virtual react DOM works in fact, but I’m not sure how to keep the generated content “independent” from the parent (e.g. fonts are inherited from the global css of the app, which is not something I want, etc.).

NOTE: just saw that this issue https://github.com/diegomura/react-pdf/issues/390 mentions that you have to wrap the <Document /> in another component that will render it properly, so what I described just above isn’t an option anyway 😅

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Skywalker13commented, Dec 7, 2018

Hey, https://codesandbox.io/s/nk6k26x2rj works with Firefox but not with Chromium…

Firefox :
image

Chromium :
image

0reactions
diegomuracommented, Jan 14, 2019

This lib reported several issues running on codesandbox (unfortunately), and I think this might be it. I’m closing this, unless until I’m proved wrong to be it 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Display a PDF in the browser in a modal from blob data using ...
I used react-pdf and pdfjsWorker (required to render the PDF). The main 'watch-outs': use a pdf worker, and include the pageNumber attribute ...
Read more >
use-pdf - npm
@react-pdf/renderer is great, you can render a PDF into an iframe using <PDFViewer/> , but to have full control over loading and error ......
Read more >
@react-pdf/renderer - NPM Package Compare versions - Socket
Create PDF files on the browser and server. Version: 3.0.0 was published by diegomura. Start using Socket to analyze @react-pdf/renderer and its 10 ......
Read more >
Generating Pdf documents in React Using React-pdf
Document ; Page; View; Image; Text; Link; Note; Canvas; PDFViewer; PDFDownloadLink; BlobProvider. You can checkout the docs for more details ...
Read more >
Components - React-pdf
This component represents the PDF document itself. ... as many pages as you want, but ensures not rendering a page inside any component...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found