Generate a pdf file

Hi all,
I have create this simple function for create a pdf:

const createPDF = async () => {
    const response = await Print.printToFileAsync({ 'html': '<h1>Wassup</h1>' });
    return response;
  }

But on iphone, android or desktop the result is: open printer option rathen download the file.
I have wrong the library?
I have try also

  const createPDF = async () => {
    const response = await Print.printToFileAsync({ 'html': '<h1>Wassup</h1>' });
    const pdfName = `${response.uri.slice(0,response.uri.lastIndexOf('/') + 1)}prenotazione_${readableDate.getTime()}.pdf`
    await FileSystem.moveAsync({
      from: response.uri,
      to: pdfName,
    });
    sharePdf(pdfName);
    console.log(pdfName);
    return response;
  }

But nothing changes

Ideally if you can you should always try to generate a PDF file in your server rather then depend on front end since different devices would behave differently. And then fetch that PDF file whenever you need.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.