Please provide the following:
- SDK Version: Expo-cli 5.0.1
- Platforms(Android/iOS/web/all): Android
- 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.