Comments (9)
add trustAllCerts={false} i fixed my problem 。 you can try <Pdf
style={{
width: pxToDp(355),
height: pxToDp(245),
}}
trustAllCerts={false}
source={source}
onError={(e)=>{
console.log('Pdf onError ' + JSON.stringify(e));
}}
/>
from react-native-pdf.
Same issue here! I am using RN 0.72.6
.
from react-native-pdf.
same! expo sdk 50.0.2
from react-native-pdf.
I also have this issue in Expo and needed the app out asap so i did a workaround.
In my case i could download the pdf and store it in the bundled assets on android and only load from url on ios. But since it's expo and it builds the android folder itself, i wrote a plugin for it.
The plugin js file i placed in the root of my project
// withCopyPdf.js
const { withDangerousMod } = require("@expo/config-plugins");
const fs = require("fs");
const path = require("path");
module.exports = function withCopyPdf(config, { pdfFilename }) {
return withDangerousMod(config, [
"android",
async config => {
// Replace the path with the path to where you keep your pdf
const filePath = path.join(
config.modRequest.projectRoot,
"assets",
"documents",
pdfFilename
);
const destPath = path.join(
config.modRequest.platformProjectRoot,
"app",
"src",
"main",
"assets",
pdfFilename
);
if (!fs.existsSync(filePath)) {
throw new Error(`File ${filePath} does not exist`);
}
if (!fs.existsSync(path.dirname(destPath))) {
fs.mkdirSync(path.dirname(destPath), { recursive: true });
}
fs.copyFileSync(filePath, destPath);
return config;
},
]);
};
In my case i had the pdf in my js source at assets/documents/pdfFilename.pdf
then i updated my app.config.json
plugin array like this
"plugins": [
["./withCopyPdf", { "pdfFilename": "pdfFilename.pdf" }],
]
Then i can use it in my app like this:
const source = Platform.OS === "ios"
? {
uri: "https://remote-pdf.com/pdfFilename.pdf",
cache: true,
}
: { uri: "bundle-assets://pdfFilename.pdf" };
Hope it can help anyone needing a quick workaround until this issue is solved.
from react-native-pdf.
In my case, I was able to show a PDF in React Native 0.72
using another library called react-native-view-pdf.
from react-native-pdf.
For me the issue was with SSL certificate when I load the file from https it worked i hope it helps
from react-native-pdf.
add trustAllCerts={false} i fixed my problem 。 you can try <Pdf style={{ width: pxToDp(355), height: pxToDp(245), }} trustAllCerts={false} source={source} onError={(e)=>{ console.log('Pdf onError ' + JSON.stringify(e)); }} />
you are right!think you
from react-native-pdf.
Related Issues (20)
- package name missing from androidManifest causes pod install error HOT 3
- PDF preview issue in Android & iOS HOT 6
- import undefined.RNPDFPackage error with 6.7.3 HOT 5
- crypto-js is no longer maintained HOT 1
- App Crash with this.lastRNBFTask.cancel is not a function HOT 21
- 6.7.4 build issue HOT 1
- Please add lazy load function with large pdf file HOT 1
- import undefined.RNPDFPackage error HOT 4
- crypto-js 3.3.0 is vulnerable and please update to 4.2.0+ HOT 1
- Unable to load file from local file system HOT 1
- Unable to read online insecure PDF file HOT 3
- Double Tap on pdf Zoom disable Issue HOT 1
- iOS: 'yoga/style/Style.h' Not Found with New Architecture Enabled HOT 3
- Web platform fails to bundle when react-native-pdf component exists HOT 1
- FitPolicy does not work based on canvas width on iOS
- file not open
- Want To show every single page as in gridView for Selection purpose
- Android buld failed due to Caused by: org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to calculate the value of task ':react-native-pdf:processDebugManifest' property 'packageOverride'. HOT 1
- Scroll bar indicator not visible
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-pdf.