Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to generate pdf client-side or server side [closed]

I want to create a pdf file with some info generated by the user. This info can be tables, images and text.

My question is, which is the best solution for my problem, is it a server-side solution or client-side?

Note: I am looking for a platform that allow me to do almost everything.

like image 320
Rui Martins Avatar asked Feb 16 '15 17:02

Rui Martins


People also ask

Should I generate PDF in frontend or backend?

If you want to generate a pdf with different templates then you need to go with front-end. If your template is the same, only the data inside it will be change then you should go with back-end.

How can I serve a PDF to a browser without storing a file on the server side?

You can receive an OutputStream in your generatePDF method. If you pass the response. getOutputStream() to the generate method then the PDF will be written to the response directly.


1 Answers

For server side fpdf is very versatile.

For client side you can try jsPDF

Example(jsPDF):

var doc = new jsPDF();
doc.text(20, 20, 'Hello world.');
doc.save('Test.pdf');
like image 106
m0bi5 Avatar answered Oct 09 '22 10:10

m0bi5