pdf from json request

Post Reply
satishk@andb
Posts: 1
Joined: Mon Nov 26, 2018 10:58 am
Company Name: Andhra bank

#1 pdf from json request

Post by satishk@andb » Wed Dec 05, 2018 6:31 pm

Any example code for converting json request in to pdf file

yagnyadatta
Posts: 2
Joined: Thu Jul 12, 2018 1:52 pm
Company Name: I-Exceed

#2 Re: pdf from json request

Post by yagnyadatta » Thu Dec 06, 2018 3:02 pm

satishk@andb wrote:
Wed Dec 05, 2018 6:31 pm
Any example code for converting json request in to pdf file
Sathish,
The question is not clear. Could you please elaborate the question in details?
What do you mean by creating pdf from json request? Where are you trying to implement?

yagnyadatta
Posts: 2
Joined: Thu Jul 12, 2018 1:52 pm
Company Name: I-Exceed

#3 Re: pdf from json request

Post by yagnyadatta » Thu Dec 06, 2018 3:05 pm

Sathish,
The question is not clear. Could you please elaborate in details?
What do you mean by converting json request to pdf file? What's the requirement for this implementation?

vicky
Posts: 1
Joined: Thu Dec 06, 2018 2:22 pm
Company Name: i-exceed

#4 Re: pdf from json request

Post by vicky » Thu Dec 06, 2018 6:55 pm

You can use jspdf plugin to achieve this. Below sample code which achieves the same -
var employees = [
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
];

var doc = new jsPDF();
employees.forEach(function(employee, i){
doc.text(20, 10 + (i * 10),
"First Name: " + employee.firstName +
"Last Name: " + employee.lastName);
});
doc.save('Test.pdf');

Post Reply