ReactJs With PDF

I have a project in react that receives a pdf in base64, in the browser it works correctly, but when trying in the app it closes the app.

Do you have a query or are you just making a statement?

You need permissions to download. If that’s the case.

my question is how can i open the pdf

Blockquote

i gave the file two read and write permissions but it kept closing the app

To find out more about the runtime error use logcat

Taifun

Which android version?

Now it is showing the following error:

Can only download HTTP/HTTPS URIs: data:application/pdf;base64,JVBERi0xLjMKJf////8KOCAwIG9iago8PAovVHlwZSAv


Don’t try to download it, just display in your webviewer, then grab the content using the webviewstring

1 Like

sorry I’m new with block structure, as I present?

We might need to start again…

What are you trying to download? The base64 string of the pdf?
Are you then trying to display the pdf and/or store it as a pdf or text file ?
Talk us through the workflow with reactJS…

My frontend (reactjs) receives from my backend (nodejs) a report in base64 format, I need to download this report in pdf format on my cell phone

Do you then run a url that makes the reactjs call the base64 back from nodejs ?
This should be a string return.
You can use the web component to do this to get the base64 ?

You will need an extension that converts base64 to file in your app.

Thank you, it’s working

What was your solution ?

yes i am using a string conversion extension.

it saves the file in: /storage/emulated/0/Download/archive.pdf

but I’m having trouble getting the app to open it or access the folder, do you know any solution?

extension: Filey: Encode and Decode Files

To start off with it may be better to save the file to your ASD (application specific directory)

/storage/emulated/0/Android/data/<packageName>/files/archive.pdf

(The above may be different in Kodular)

You will then need an extension to view a locally stored pdf, search pdf here