'Pdf file not created using react-native-html-to-pdf

I am using React Native v0.67.2 and looking to generate PDF from HTML using react-native-html-to-pdf. This is the function I use to generate the PDF, but the location of generated Pdf isn't showing in the iOS file manager.

const createPDF = async () => {
  let options = {
    html: '<h1>PDF TEST</h1>',
    fileName: 'testFile',
    directory: 'Documents',
  };

  let file = await RNHTMLtoPDF.convert(options);

  // console.log(file.filePath);
  alert(file.filePath);
}

The file exists in an unknown location, but I'm expecting the downloaded PDF file in the 'Documents' directory of iPhone Files. How do I move the PDF to this location and resolve this issue?

Thank you in advance.



Solution 1:[1]

Duplicate of: pdf created by react native html to pdf is not showing in provided path

On IOS you can only use that Documents path that you already have. You cannot make it save anywhere else.

Directory where the file will be created (Documents folder in example above). Please note, on iOS Documents is the only custom value that is accepted.

Ref: https://github.com/christopherdro/react-native-html-to-pdf#options

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Obsidianlab