I would like to transform an SVG file containing Javascript to PDF. If the Javascript code is embedded inside the SVG file, everything works fine. But if the Javascript is in a separate file, it doesn’t work.
Is there something to do about it?
I am using Prince v12.5 on macOS.
For example, this doesn’t work:
But this works:
Is there something to do about it?
I am using Prince v12.5 on macOS.
For example, this doesn’t work:
<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="-1.3 -1.0 2.6 2.0"
preserveAspectRatio="xMidYMid meet"
>
<g id="container"></g>
<script type="text/javascript" xlink:href="testsvg.js"></script>
</svg>
"use strict"
var container = document.getElementById("container");
var path = document.createElementNS("http://www.w3.org/2000/svg", "path");
path.setAttribute("d", "M 0,0 h 0.1 v 0.1 h -0.1 z");
container.appendChild(path);
But this works:
<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="-1.3 -1.0 2.6 2.0"
preserveAspectRatio="xMidYMid meet"
>
<g id="container"></g>
<script type="text/javascript">
"use strict"
var container = document.getElementById("container");
var path = document.createElementNS("http://www.w3.org/2000/svg", "path");
path.setAttribute("d", "M 0,0 h 0.1 v 0.1 h -0.1 z");
container.appendChild(path);
</script>
</svg>