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.
-
Why invent the wheel again when someone else already have done it? If there is a framework which fits our requirements, then use it. – paly Dec 22 '11 at 07:36
-
1@paly: Never hurts to 'reinvent the wheel' when you want to learn to build a cart no? He might want to do it for educational purposes? – ChrisR Dec 22 '11 at 07:39
-
1@paly I actually want to learn how to do it so that I can implement it better and increase my knowledge upon the same. I am really not aware hoe the PDF generators work and am really keen to know about it. I guess reinventing helps ;) – Shiv Kumar Ganesh Dec 22 '11 at 07:43
-
1@Shiv Kumar Ganesh: Then carry on if you want to learn something new, I like own implementation, but I have to decide what reinvent and what not. Good luck ;) – paly Dec 22 '11 at 07:49
-
@Shiv Kumar Ganesh what progress have you done on this matter? I want to do the same thing, implement a PDF library for my favorite front end programming language called elm. Because currently, there is no way to create PDF documents from elm directly. I don't know where to start, i can't understand what the main idea behind PDF is. How JavaScript is actually transformed in PDF? With inspect element, the pdf appears as composed from a bunch of divs. This can'tberight. What is the actual underlining language behind pdf? Can you please tell me what should i do in my current situation? Thanks :) – AIon May 01 '17 at 20:22
2 Answers
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.

- 69,653
- 9
- 115
- 144
-
Thanks for the above information. I would definitely get along with the specification.Are there any other links apart from the above links? As in any other resource? – Shiv Kumar Ganesh Dec 22 '11 at 07:46
-
@ShivKumarGanesh you are welcome :-) what sort of resources are you looking for ? the standard it THE authority on PDF, from there it depends on what exactly you want to implement (for example if you want to display PDFs or if you want to create encrypted PDFs etc.). – Yahia Dec 22 '11 at 07:49
-
So I guess, after I am done with the specification, I would be able to directly think upon how to work out with PDF's as well as how to implement right?? – Shiv Kumar Ganesh Dec 22 '11 at 07:52
-
@ShivKumarGanesh The specification is the fundament - so yes. AFTER you decide which parts you want to implement there might be additional usefull resources to check out. – Yahia Dec 22 '11 at 07:54
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');

- 463
- 2
- 9
-
@Luis_Medel I have already mentioned about jsPDF on the starting of my post. I am trying to make a new library/framework because I want to learn how the thing works. Thats all. Please refer some good docs if you are aware of. Thanks :) – Shiv Kumar Ganesh Dec 22 '11 at 07:49