forked from fleebzz/carbone-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
35 lines (29 loc) · 947 Bytes
/
test.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Carbone Docker wrapper tester</title>
</head>
<body>
<form onsubmit="formatData()" action="/render" method="post" target="_blank" enctype="multipart/form-data">
<input type="file" name="template" id="template">
<input type="hidden" name="data" id="data">
<input type="hidden" name="format" value="pdf">
<input type="hidden" name="outputName" value="test.pdf">
<textarea name="_data" id="_data" cols="30" rows="10">{"firstname":"John"}</textarea>
<input type="submit" value="Generate">
</form>
<script>
function formatData() {
const _data = document.getElementById(`_data`).value;
let data = {};
try {
data = JSON.parse(_data);
} catch (e) {
console.error(`Cannot parse data : ${e}`);
}
document.getElementById(`data`).value = JSON.stringify(data);
}
</script>
</body>
</html>