Forum How do I...?

Javascript Library

sanjaymk
Hello -

I would like to use Prince to generate PDFs through Javascript or some web interface. I have an app that generates HTML pages, I would like to programatically enable users to print the generated HTML page using a print button on the page. Is it possible to accomplish this using Prince javascript library or any other library?

Any replies appreciated.

Sanjay
mikeday
How about trying DocRaptor?
sanjaymk
Thanks. Will take a look.

Is there an API library for Prince in any language?
sanjaymk
Thanks. Will take a look.

Is there an API library for Prince in any language OR the only way to use Prince through the command line and GUI tool?
mikeday
Yes we have wrappers for Java, C#, PHP, etc.
hallvord
Hi sanjaymk, I think using wrappers and some simple server-side coding in one of the supported languages will enable you to do this. One word of warning though: be careful about letting users pass untrusted content to Prince, it is very hard to do this safely. End users submitting random HTML could come up with weird ideas for attacking either your server or somebody else through you (for example telling Prince to render 1000nds of IFRAMEs embedding a site they want to do a DOS attack against). If possible, either generate the HTML on the server or do some parsing and sanitizing before the HTML goes to Prince.

Hope it works out :)

Announcement: repos for tests/utils

mikeday
There is only one X character displayed which is good, but it would be nice if we could trim the blank page that follows.