Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

PDFGeneration - Anyone tried it??


Reply


26 Posts   7536 Views

Avatar
Borgopio

Community Member, 14 Posts

24 December 2010 at 10:11pm

update

The images issue that I've mentioned in my previous post was referred to a base path problem, now solved.
Marcus Nyeholt updated the github and now the pdfrendition module works like a charm!!!
I truly raccomend it to generate PDF from the site page.

Cheers
Giulio

Avatar
Marcus

Administrator, 86 Posts

4 January 2011 at 3:53pm

Just noticed this thread - the PDF Rendition module at http://github.com/nyeholt/silverstripe-pdfrendition uses the XHTMLRenderer (aka Flying Saucer) engine https://xhtmlrenderer.dev.java.net/ for converting HTML into PDFs. The main drawback to it is that it requires Java to be installed on the server for performing the conversion, but many hosts will already have this installed.

The nice thing about it is that it implements CSS2.1, meaning all the print specific things that you might want to do (headers/footers, multipage tables, explicit page breaks, table of contents etc) are all handled by applying print specific CSS to the existing page content. There's some examples on the github wiki (https://github.com/nyeholt/silverstripe-pdfrendition/wiki/Markup-hints) at the moment, with more to be added soonish. Once the examples are more up-to-date, I'll be having it listed on the main modules site.

Avatar
Indika

Community Member, 3 Posts

26 January 2011 at 4:15am

if you want to generate pdf , you can use html2pdf library . for more information please read my blog
http://indikagamage.com/blog/how-to-html-to-pdf-in-silverstripe/

Avatar
michaelhmm

Community Member, 23 Posts

18 February 2011 at 4:46am

Edited: 18/02/2011 4:48am

Markus - "it requires Java to be installed on the server"

Java on the server - does this mean something like Tomcat on Apache?

Avatar
Marcus

Administrator, 86 Posts

18 February 2011 at 11:32am

Nope, doesn't need tomcat at all, just the java binary itself. The module comes bundled with a jar file that is called by the generation process directly, it doesn't need any servlet container.

Avatar
michaelhmm

Community Member, 23 Posts

18 February 2011 at 11:48pm

Thanks Markus, I have not come across this type of use of java before.

Avatar
michaelhmm

Community Member, 23 Posts

24 May 2011 at 1:25am

Markus, in your latest changelog entry on Github you state: "Templates can be defined that allow the specification of complex
PDFs using content aggregations etc."

Does this mean it would be possible to create a single pdf from a number of individual pages ( for example all the pages in one sub-section of the site tree). ? I don't understand what you mean by content aggregations.

Avatar
swaiba

Forum Moderator, 1799 Posts

23 July 2011 at 1:17am

I've hassled the amazing UncleCheese for the code discussed earlier... I've now made a simple rendering straight away with it... I'm now attaching it here to this thread for all interested parties (Note - I have done the most basic html example only).

some notes from UncleCheese

"90% of the work in PDF to HTML conversion, in my experience, is HTML and CSS pixel pushing. It's a lot like designing an email template, only with even less tolerance of standards. You've got to use a lot of tables for layout, presentational attributes, and all kinds of circa 2002 markup to get it right. It's a struggle."

AND

"the embedded CSS.. there are a couple key properties like "page-break-before: always;" which is important for multi-page PDFs (HTML doesn't understand the concept of page breaks..)"

I haven't gone through this step - just the initial use of the code to render simple HTML page.

(note I have only included the basic example and none of my or UC css/templates)

Attached Files