when including script tags in html for Android the code inside the tag gets ignored but for IOS it works.

Please provide the following:

  1. SDK Version: Expo-cli 5.0.1
  2. Platforms(Android/iOS/web/all): Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on. Expo-Print

Replace this section with as much relevant information as possible and any relevant code along with your question.

Code:

const html = `
<!DOCTYPE html>
  
    <html lang="en">
  
   
  
    <head>
  
        <meta charset="UTF-8">
  
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
        <title>Blood Pressure Diary</title>
  
        <style>
  
            table, th, tr, td {
  
                border:1px solid black;
  
            }
  
            td {
  
                text-align: center;
  
            }
  
        </style>
  
    </head>
  
   
  
    <body>
  
        <h1>Diary: Blood Pressure</h1>
  
        <h1>Date Generated: <span id="date"></span></h1>
  
 
        <script>
  
            n = new Date();
  
            y = n.getFullYear();
  
            m = n.getMonth() + 1;
  
            d = n.getDate();
  
            document.getElementById("date").innerHTML = d + "/" + m + "/" + y;
  
        </script>
  
    </body>
  
    </html>`

THEN using this code :

const file_object = await Print.printToFileAsync({

                html: htmlContent,

            });

When ran on an IOS device, the script tag works and shows the date on the pdf page but on Android it appears that the script tag is ignored.

Hey @keivansh10, can you provide a reproducible example of this that is public and we can run locally? Your code block is a bit messy and unformatted.

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