Failed to load PDF file from URL
See original GitHub issueBefore you start - checklist
- I have read documentation in README
- I have checked sample and test suites to see real life basic implementation
- I have checked if this question is not already asked
What are you trying to achieve? Please describe. Unable to render pdf (url)
Describe what are you trying to achieve Ex. I’d like to display multiple pages of my PDF. I’m trying to render pdf from url , but I get the following error in the browser
failed to load pdf file
pages of
Describe solutions you’ve tried SamplePdf.jsx
import React, {Component} from "react";
import {Document, Page} from 'react-pdf';
class Sample extends Component {
constructor(props) {
super(props);
this.state = {
numPages: null,
pageNumber: 1
};
}
onDocumentLoad({numPages}) {
this.setState({numPages});
}
render() {
const {pageNumber, numPages} = this.setState;
return (
<div>
<Document
file={{url: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf'}}
onLoadSuccess={this.onDocumentLoad}>
<Page pageNumber={pageNumber}/>
</Document>
<p>Page {pageNumber} of {numPages}</p>
</div>
);
}
}
export default Sample;
index.jsx
import React from 'react';
import { storiesOf } from '@storybook/react';
import Sample from '../Sample';
const storyPath = 'TrialComponents/reactpdf';
storiesOf(storyPath, module)
.add('Static', () => <Sample />);
Additional information
Environment
- Browser (if applicable) [e.g. Chrome 57, Firefox 59]:
- React-PDF version [e.g. 3.0.4]:
- React version [e.g. 16.3.0]:
- Webpack version (if applicable) [e.g. 4.16.2]:
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
8 Ways to Fix Failed to Load PDF Document Error
How do I fix a PDF failed to load? · 1. Download the latest Adobe Reader version · 2. Change PDF settings in...
Read more >Fix: Error Failed to Load PDF Document in Chrome - Appuals
Visit this link (here) and click on Add to Chrome to install the PDF Viewer Extension. Then click Add Extension to confirm the...
Read more >How to Fix Error Failed to Load PDF Document in Chrome
Fix 1: Update Google Chrome to the Latest Version ... Sometimes PDF won't load in Chrome due to the old version of this...
Read more >Failed to load PDF document in Chrome - Stack Overflow
Opening Google Chrome (obviously) · In the top right, click More Untitled. · At the bottom, click Show Advanced Settings. · Under Privacy,...
Read more >Error: Failed to load PDF document - ShiftCare Help Center
The error message "failed to load pdf document" means the web browser is having difficulty opening the file. The problem might be your...
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
OK, so duplicate. Where is the answered or original?
Sorry this is a duplicate issue. Closing it. Thanks