forked from aeischeid/grails-pdfplugin
-
Notifications
You must be signed in to change notification settings - Fork 1
simple plugin to generate PDF's from GSP's on the fly
mkuhl/grails-pdfplugin
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Grails PDF Plugin author: Aaron Eischeid Pdf plugin allows a Grails application to generate PDFs and send them to the browser by converting existing pages in your application to PDF on the fly. The underlying system uses the xhtmlrenderer component from java.net along with iText to do the rendering. Install the plugin from the grails repositories using the grails command: "grails install-plugin pdf" Or you can use the zip file on Github. "grails install-plugin [path/to/zip/file]" <------------> Usage: <------------> The plugin is really easy to use. Basically just use the tag libraries as described in the demo.gsp and the gsp that you reference in the tag will be rendered as a PDF file. You should probably make some effort to style the PDF for print media and the XHTMLrenderer under the hood provides some help in this area by enabling the use of certain CSS 3 properties. That is really all there is to it... There are a couple things to watch out for. The first thing is that form elements pretty much just get ignored in the PDF rendering process, and that can leave unpredictable spaces (or lack of spaces) in the page. The second thing is that the underlying renderer ignores javascript. So pages that have javascript effects, or content added via AJAX will not render as they would in a web browser. This is not a bug! PDF's are meant to be static documents, and web pages usually aren't. However, a number of people have expressed interest in the ability of the plugin to render a snapshot of the page as it appears in the browser at any given moment, and that is very doable, it just hasn't been added yet. A common question is what happens to images. Images and externally linked CSS files should be automatically resolved. <-------------------> Tag Documentation <-------------------> g:pdfLink attributes: * url (required) - the url of the gsp you want to convert to PDF * filename (optional) - what you want the filename of the resultant PDF to be - defualt = 'document.pdf' * icon (optional) - will add an <img … /> tag * class (optional) - set the class of element - default = 'pdf' g:pdfForm attributes: * url (required) - the url of the gsp to want to convert to PDF * filename (optional) - what you want the filename of the resultant PDF to be * name (optional) - becomes the name and id of HTML form - default = 'simplePdfForm' * method (optional) - the method of the form - default = 'get' * template (optional) - template you want to render as a pdf, method must = post (since 0.4) * controller (optional) - requires action method='post' (since 0.4) * action (optional) - controller action for rendering PDF (since 0.4)
About
simple plugin to generate PDF's from GSP's on the fly
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Groovy 100.0%