Hi All, first post here.

I am trying to Save as PDF a Layout that contains a webviewer.

I can accomplish this by:

going to that Layout,

clicking Preview,

clicking Save as PDF,

selecting the Folder required

and then saving.

When I attempt this via the script I receive the following error message:

Any help in resolving this issue would be greatly appreciated.

Regards

Milton.

On the Layout as shown below, I have the following items:

Players::PhotoDefault: Container, External (Open)

Players::id_fk_PlayerNickname: Calculation, result is Text.

4 Merge Fields as follows: (Merge fields enclosed in quotes)

"First" has Played: = Players::First

"PlayerGames2024Thursday" Games on a Thursday for a Total of "PlayerPoints2024Thursday" Points.

"PlayerGames2024Friday" Games on a Friday for a Total of "PlayerPoints2024Friday" Points.

"PlayerGames2024Sunday" Games on a Sunday for a Total of "PlayerPoints2024Sunday" Points.

And the Webviewer named "Weekly-Chart-Lge"

The Contents of the Webviewer are below.

The script to Save as PDF is as follows:

```
#Set the full file path
Set Variable [$ChartPath; Value:"filewin:/C:/Users/milta/OneDrive/Toowong - Personal/Toowong Website - 2024/Charts/" & Players::FirstAndLastPDF
#Players::FirstAndLastPDF holds: Players::First & " " & Players::Last & ".pdf"
#Save the current record as a PDF
Print Setup [Restore; With dialog:Off]
Save Records as PDF [Restore; With dialog: Off; "$ChartPath"; Current Record; Create Folders: Off]
```

The settings for Print Setup are:

Printer Name: Microsoft Print to PDF

Paper size: A4

Orientation: Landscape.

For the Save Records as PDF options:

Specify options are set to:

Current Record

Options: Page 1 through 1

And the Webviewer named "Weekly-Chart-Lge"

The contents of the Webviewer are as follows:

```
"<!DOCTYPE html>
<html>
<script src=\"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js\"></script>
<body>
<canvas id=\"myChart\" style=\"width:100%;max-width:1500px\"></canvas>
<script>
const xValues = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44];
const yValues1 = [
" & Players::WK1 TH & ",
" & Players::WK2 TH & ",
" & Players::WK3 TH & ",
" & Players::WK4 TH & ",
" & Players::WK5 TH & ",
" & Players::WK6 TH & ",
" & Players::WK7 TH & ",
" & Players::WK8 TH & ",
" & Players::WK9 TH & ",
" & Players::WK10 TH & ",
" & Players::WK11 TH & ",
" & Players::WK12 TH & ",
" & Players::WK13 TH & ",
" & Players::WK14 TH & ",
" & Players::WK15 TH & ",
" & Players::WK16 TH & ",
" & Players::WK17 TH & ",
" & Players::WK18 TH & ",
" & Players::WK19 TH & ",
" & Players::WK20 TH & ",
" & Players::WK21 TH & ",
" & Players::WK22 TH & ",
" & Players::WK23 TH & ",
" & Players::WK24 TH & ",
" & Players::WK25 TH & ",
" & Players::WK26 TH & ",
" & Players::WK27 TH & ",
" & Players::WK28 TH & ",
" & Players::WK29 TH & ",
" & Players::WK30 TH & ",
" & Players::WK31 TH & ",
" & Players::WK32 TH & ",
" & Players::WK33 TH & ",
" & Players::WK34 TH & ",
" & Players::WK35 TH & ",
" & Players::WK36 TH & ",
" & Players::WK37 TH & ",
" & Players::WK38 TH & ",
" & Players::WK39 TH & ",
" & Players::WK40 TH & ",
" & Players::WK41 TH & ",
" & Players::WK42 TH & ",
" & Players::WK43 TH & ",
" & Players::WK44 TH & "
];
const yValues2 = [
" & Players::WK1 FRI & ",
" & Players::WK2 FRI & ",
" & Players::WK3 FRI & ",
" & Players::WK4 FRI & ",
" & Players::WK5 FRI & ",
" & Players::WK6 FRI & ",
" & Players::WK7 FRI & ",
" & Players::WK8 FRI & ",
" & Players::WK9 FRI & ",
" & Players::WK10 FRI & ",
" & Players::WK11 FRI & ",
" & Players::WK12 FRI & ",
" & Players::WK13 FRI & ",
" & Players::WK14 FRI & ",
" & Players::WK15 FRI & ",
" & Players::WK16 FRI & ",
" & Players::WK17 FRI & ",
" & Players::WK18 FRI & ",
" & Players::WK19 FRI & ",
" & Players::WK20 FRI & ",
" & Players::WK21 FRI & ",
" & Players::WK22 FRI & ",
" & Players::WK23 FRI & ",
" & Players::WK24 FRI & ",
" & Players::WK25 FRI & ",
" & Players::WK26 FRI & ",
" & Players::WK27 FRI & ",
" & Players::WK28 FRI & ",
" & Players::WK29 FRI & ",
" & Players::WK30 FRI & ",
" & Players::WK31 FRI & ",
" & Players::WK32 FRI & ",
" & Players::WK33 FRI & ",
" & Players::WK34 FRI & ",
" & Players::WK35 FRI & ",
" & Players::WK36 FRI & ",
" & Players::WK37 FRI & ",
" & Players::WK38 FRI & ",
" & Players::WK39 FRI & ",
" & Players::WK40 FRI & ",
" & Players::WK41 FRI & ",
" & Players::WK42 FRI & ",
" & Players::WK43 FRI & ",
" & Players::WK44 FRI & "
];
const yValues3 = [
" & Players::WK1 SUN & ",
" & Players::WK2 SUN & ",
" & Players::WK3 SUN & ",
" & Players::WK4 SUN & ",
" & Players::WK5 SUN & ",
" & Players::WK6 SUN & ",
" & Players::WK7 SUN & ",
" & Players::WK8 SUN & ",
" & Players::WK9 SUN & ",
" & Players::WK10 SUN & ",
" & Players::WK11 SUN & ",
" & Players::WK12 SUN & ",
" & Players::WK13 SUN & ",
" & Players::WK14 SUN & ",
" & Players::WK15 SUN & ",
" & Players::WK16 SUN & ",
" & Players::WK17 SUN & ",
" & Players::WK18 SUN & ",
" & Players::WK19 SUN & ",
" & Players::WK20 SUN & ",
" & Players::WK21 SUN & ",
" & Players::WK22 SUN & ",
" & Players::WK23 SUN & ",
" & Players::WK24 SUN & ",
" & Players::WK25 SUN & ",
" & Players::WK26 SUN & ",
" & Players::WK27 SUN & ",
" & Players::WK28 SUN & ",
" & Players::WK29 SUN & ",
" & Players::WK30 SUN & ",
" & Players::WK31 SUN & ",
" & Players::WK32 SUN & ",
" & Players::WK33 SUN & ",
" & Players::WK34 SUN & ",
" & Players::WK35 SUN & ",
" & Players::WK36 SUN & ",
" & Players::WK37 SUN & ",
" & Players::WK38 SUN & ",
" & Players::WK39 SUN & ",
" & Players::WK40 SUN & ",
" & Players::WK41 SUN & ",
" & Players::WK42 SUN & ",
" & Players::WK43 SUN & ",
" & Players::WK44 SUN & "
];
new Chart(\"myChart\", {
type: \"line\",
data: {
labels: xValues,
datasets: [
{
label: 'Thursday',
fill: false,
lineTension: 0,
backgroundColor: \"rgba(0,0,255,1.0)\",
borderColor: \"rgba(0,0,255,0.1)\",
data: yValues1
},
{
label: 'Friday',
fill: false,
lineTension: 0,
backgroundColor: \"rgba(255,0,0,1.0)\",
borderColor: \"rgba(255,0,0,0.1)\",
data: yValues2
},
{
label: 'Sunday',
fill: false,
lineTension: 0,
backgroundColor: \"rgba(0,255,0,1.0)\",
borderColor: \"rgba(0,255,0,0.1)\",
data: yValues3
}
]
},
options: {
legend: {
display: true,
position: 'top',
labels: {
fontColor: 'rgb(0, 0, 0)',
fontSize: 14
}
},
scales: {
yAxes: [{
ticks: {
min: 0,
max:250}}],
}
}
});
</script>
</body>
</html>"
```