Question
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
BlueRose Technologies
SE
Last activity: 27 Mar 2018 0:03 EDT
Javascript is not supported while generating PDF from HTML file
Hi All,
I have the below code in HTML rule and needs to get generated as Pdf using an activity. From the below code, everything is working as expected except <script> tag.
Appreciate your response in advance.
Code:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Loops</h2>
<p id="demo"></p>
<script>
var text = "";
var i;
for (i = 0; i < 1; i++) {
text += "The number is " + i + "<br>";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
***Updated by moderator: Lochan to add Categories***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
J.P. Morgan Services India PVT Ltd
IN
hello,
looks like script is working fine, I just tried the below code by printing a simple string
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Loops</h2>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "pega";
</script>
</body>
</html>
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
BlueRose Technologies
SE
Hi Neha,
I have for loop in my code and that is not supporting while generating the Pdf.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
J.P. Morgan Services India PVT Ltd
IN
Hello,
I have cross checked looks like there is some issue also I tried using loop into a function still it didn't work for me, but when I tried it in the HTML fragment "MyAlerts" which is part of @baseclass and tried generating pdf for the same it is displaying and this html does contain some loop, you can refer that.
meanwhile, I will check where is the loophole and get back to you.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
Hi,
Try to use the code in a non auto generated section and use this section in a PDF utility i.e smart shape to covert it to a PDF .
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
BlueRose Technologies
SE
Hi Sahu,
Have you tried my code in the same scenario which you suggested and get the response like below.
Response:
1
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
BlueRose Technologies
SE
Hi Sahu,
For loop is not getting supported even in non generated section. Please test and confirm on the same.
Thanks,
Ranz
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
HI Ranz,
Please tell me the version of Pega you are using ,I will definitely try it .
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
BlueRose Technologies
SE
Hi Sahu,
I am using 7.1.7 version. Please check and update on the same.
Thanks,
Ranz