[英]Print JSON response as PDF or Excel using JavaScript
Im using the Form.io ( http://formio.github.io/formio.js/app/examples/customendpoint.html 我正在使用Form.io( http://formio.github.io/formio.js/app/examples/customendpoint.html
// Triggered when they click the submit button.
form.on('submit', function(submission) {
console.log(submission);
alert('Submission sent to custom endpoint. See developer console.');
return fetch('https://hookb.in/ZrRRbJBe', {
body: JSON.stringify(submission),
headers: {
'content-type': 'application/json'
},
method: 'POST',
mode: 'cors',
})
.then(response => {
form.emit('submitDone', submission)
response.json()
})
});
});
and i'm getting the JSON response in the console log. 而且我在控制台日志中得到了JSON响应。 I'm trying instead of putting it in the console log, i want to put the data in the PDF format. 我正在尝试将数据放在PDF格式中,而不是将其放入控制台日志中。 I used the code 我用了代码
<div class="entry">
<h1>{{data.page1Text}}</h1>
<div class="body">
{{body}}
</div>
But still its coming as the {{data.page1Text}}
,any ways i can use that JSON to put as the PDF format or put in the EXCEL ,rather than putting in the Console. 但是它仍然以{{data.page1Text}}
,我可以使用该JSON以PDF格式或以EXCEL的任何方式,而不是以控制台的方式。
要在PDF输出中显示表单数据,您将需要在表单中使用Content组件,然后可以使用以下组件来打印字段数据。
<h1>{{ data.page1Text }}</h1>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.