Shiv Kumar Ganesh
Shiv Kumar Ganesh

Reputation: 3825

How to build a PDF framework in JavaScript?

I wanted to know how to generate a PDF. I have seen few frameworks across like jsPDF and others but am eager to build up my own framework so as to understand better how to work with PDF and how does the entire concept of pdf works. Please let me know proper place where I can get a head start with the following and can plan out how to start to build a framework. Any suggestions are highly appreciated. Resources are welcomed too.I want to do the entire thing in JavaScript, so please feel free to guide me.

Upvotes: 2

Views: 1269

Answers (2)

Luis Medel
Luis Medel

Reputation: 463

If you want to build a framework because you think there isn't a library for this, you should check jsPDF. It's a javascript library for PDF generation.

http://code.google.com/p/jspdf/

I've not used it in a large project, but it's very easy to use.

From the demo (http://snapshotmedia.co.uk/blog/jspdf):

var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage();
doc.text(20, 20, 'Do you like that?');

// Output as Data URI
doc.output('datauri');

Upvotes: 2

Yahia
Yahia

Reputation: 70369

The very first thing you need to do is make yourself familiar with the PDF standard - see http://www.adobe.com/devnet/pdf.html and http://www.adobe.com/devnet/pdf/pdf_reference.html .

Then you need to decide if you want to implement the full standard, parts of it, a renderer and/or generator etc.

After that you should concentrate on studying any opensource framework which implements what you are after...

Then start coding... and come back with any specific questions as they arise.

Upvotes: 4

Related Questions