christopherdro / react-native-html-to-pdf

Convert html strings to PDF documents using React Native
MIT License
435 stars 269 forks source link

Unable to convert PDF using promise.all #200

Closed edilsonlm217 closed 3 years ago

edilsonlm217 commented 3 years ago

Hi guys,

I'm trying to generate PDF files using promise.All but it doesn't work at all.

That's my code:

async function handleCreatePDF() {
    var promises = [];

    const fileName = ['temp_1', 'temp_2'];

    fileName.map((name) => {
      promises.push(
        RNHTMLtoPDF.convert({
          html: '<h1>Hello World</h1>',
          fileName: name,
          directory: 'Documents',
          height: 595,
          width: 420,
        }),
      );
    });

    await Promise.all(promises).then((data) => console.log(data));
  }

If I run the exact same code but generating only one promise it works as expected. But If I got 2 or more files to convert it does not return anything.

react-native": "0.63.3" "react-native-html-to-pdf": "^0.8.0",

Could you guys help me?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.