• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

382
Views
Save pdf to desired location in device React Native

I'm using RNHTMLtoPDF from 'react-native-html-to-pdf' and I want to store to my desired location so what should I do? I have a path that is storage emulated and that path is saved in a hook but I want this pdf downloaded to be in my device storage. Any help regarding this matter would be highly appreciated

enter image description here

about 3 years ago · Juan Pablo Isaza
2 answers
Answer question

0

maybe add a standard 'share' component from react-native?

https://reactnative.dev/docs/share

and the logic is when you click on pdf or whatever button you have - the share component will be opened and then you'll choose where you want to put that file(also to save it on your phone)

about 3 years ago · Juan Pablo Isaza Report

0

You can use npm i react-native-fs library for save in local devices

Sample Code:

import React from 'react';
import {View, Text, TouchableOpacity} from 'react-native';
import RNFS from 'react-native-fs';

export default function App() {

  //if you want to save in download directory then you can use this path
  const path = RNFS.DownloadDirectoryPath;

  const saveFile = () => {
    RNFS.copyFile(yourCurrentFilePath, yourDestinationFilePath);
  };

  return (
    <View style={{flex: 1}}>
      <TouchableOpacity onPress={() => saveFile()}>
        <Text>Save</Text>
      </TouchableOpacity>
    </View>
  );
}

For More Information you can explore the react-native-fs library documents react-native-fs

about 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error