Giter Club home page Giter Club logo

Comments (16)

wonday avatar wonday commented on August 18, 2024 4

If you have the pdf file at "android/app/src/main/assets/pdf/userGuide.pdf",
you should use let source = {uri:'bundle-assets://pdf/userGuide.pdf'}

from react-native-pdf.

wonday avatar wonday commented on August 18, 2024 3

if you use {uri:"bundle-assets://path/to/xxx.pdf"}
you must put pdf to android folder.
like this:
android/app/src/main/assets/path/to/xxx.pdf

from react-native-pdf.

wonday avatar wonday commented on August 18, 2024

Do you mean source={require("./test.pdf")} ?
As my tested before, require a pdf at ios and android debug version can work, but android release version does not work.
You can use {uri:"bundle-assets://path/to/xxx.pdf"} for android.

from react-native-pdf.

shyam528 avatar shyam528 commented on August 18, 2024

Thanks for the reply . Have to put pdf files in android's asset folder or i can put it anywhere.
{uri:"bundle-assets://path/to/xxx.pdf"}
here from i have pdf in my JS folder , so I have to put that pdf in android folder or i can just give the full path name

from react-native-pdf.

jkvim avatar jkvim commented on August 18, 2024

so we should keep two copy of pdf ?

from react-native-pdf.

wonday avatar wonday commented on August 18, 2024

@jkvim

In source, you can keep two copy of pdf for android and iOS,
But in built version only one copy in android or iOS app.

If you want to use one copy in source, you can keep android copy, and add it to iOS by reference.

from react-native-pdf.

zdl411437734 avatar zdl411437734 commented on August 18, 2024

i use let source = {uri:'bundle-assets://path/to/QXTTV.pdf'}; app crash error msg is /ReactNativeJS: undefined is not a function (evaluating 'l.default.fs.cp(r,n).progress(function(e,r){o.props.onLoadProgress&&o.props.onLoadProgress(e/r),o.setState({progress:e/r})})')

when i use let source = {uri:'https://www.irs.gov/pub/irs-pdf/fw2.pdf',cache:true}; it ok ,what happen? please help me think you!

from react-native-pdf.

zdl411437734 avatar zdl411437734 commented on August 18, 2024

@wonday

from react-native-pdf.

wonday avatar wonday commented on August 18, 2024

source = {uri:'bundle-assets://path/to/QXTTV.pdf'};

"path/to/QXTTV.pdf" should be real assets path in your source under android/app/src/main/assets/
does it exist?

from react-native-pdf.

juanriglos avatar juanriglos commented on August 18, 2024

it s not working for me, any help?, i'm trying to make it work on android, i tried all the ways,
using:
let source = {uri:"bundle-assets://path/to/pdf-sample.pdf"}
let source = {uri:'bundle-assets://android/app/src/main/assets/pdf/userGuide.pdf'}

and in all ways didnt work,

from react-native-pdf.

juanriglos avatar juanriglos commented on August 18, 2024

i copy the exactly code from documentation i tried also doing let source = {uri:'bundle-assets://pdf/userGuide.pdf'}. My version is "react-native-pdf": "^1.0.5", "react": "15.3.2",
"react-native": "0.36.0". Can i upgrade the version of the pdf maintance the react native version?.
Thanks for the help!!

from react-native-pdf.

wonday avatar wonday commented on August 18, 2024

"uri:'bundle-assets://", was added at react-native-pdf ver 1.0.6,
so you should use ver 1.0.6+, but I do not test it with react-native <0.40.0,
I am not sure it can run or not.

you can see the detail release notes at here

from react-native-pdf.

juanriglos avatar juanriglos commented on August 18, 2024

thanks for the fast feedback I upgrade to 1.0.6 and the messaje now is "pdf has no proptype for native prop rctpdf.asset of native type string if you havent changed this prop yourself, this usually means that your versions of the native code and javascript code are out of sync. updating both should make this error go away".

If i want to use the uri:FILE:
let source = {uri:"file:////home/me//android-app/android/app/src/main/assets/pdf/userGuide.pdf"}.
How it's works?
Thanks!

from react-native-pdf.

wonday avatar wonday commented on August 18, 2024

It can not work. the "android/app/src/main/assets" is not real path in your system.
Dose it work if you use local file? like let source = {uri:"file:////sdcard/xxx/xxx.pdf"}.

from react-native-pdf.

juanriglos avatar juanriglos commented on August 18, 2024

i want to add the pdf in the App, it's here "home/me/android-app/js/components/help/userGuide.pdf".
i am trying with many ways, like:
let source = {uri:"file:////home/me/android-app/js/components/help/userGuide.pdf"}
but still now working, i need to make it works with react-native-pdf 1.0.5, because upgrading break up all my App. Thanks for all

from react-native-pdf.

wonday avatar wonday commented on August 18, 2024

show the pdf in the App need "uri:'bundle-assets://", but it seems not work.
if you can use let source = {uri:"file:////sdcard/xxx/xxx.pdf"},
You can use react-native-fetch-blob copy the asset pdf to temp path and show it.
for detail, you can see here
or my source code

from react-native-pdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.