Look also at this open-source project:
PDF.js[
^].
But, first of all, think at this: do you really want to generate PDF, not something more reasonable, for example, HTML.
PDF is not editable, and not so pleasant to read on a computer, this is rather a kind of electronic paper. It is totally foreign to the Web, is not a part of W3 standards. If you used HTML, your problem would be trivial, the result usable on all systems, not worse than PDF, and so on.
—SA