Jump to:

10929 Posts in 2613 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » PDFGeneration - Anyone tried it??

Discuss all other Modules here.

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

Page: 1 2 3 4
Go to End
Author Topic: 7180 Views
  • Borgopio
    Avatar
    Community Member
    14 Posts

    Re: PDFGeneration - Anyone tried it?? Link to this post

    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

  • Marcus
    Avatar
    Administrator
    86 Posts

    Re: PDFGeneration - Anyone tried it?? Link to this post

    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.

  • Indika
    Avatar
    Community Member
    3 Posts

    Re: PDFGeneration - Anyone tried it?? Link to this post

    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/

  • michaelhmm
    Avatar
    Community Member
    23 Posts

    Re: PDFGeneration - Anyone tried it?? Link to this post

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

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

  • Marcus
    Avatar
    Administrator
    86 Posts

    Re: PDFGeneration - Anyone tried it?? Link to this post

    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.

  • michaelhmm
    Avatar
    Community Member
    23 Posts

    Re: PDFGeneration - Anyone tried it?? Link to this post

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

  • michaelhmm
    Avatar
    Community Member
    23 Posts

    Re: PDFGeneration - Anyone tried it?? Link to this post

    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.

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: PDFGeneration - Anyone tried it?? Link to this post

    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
    7180 Views
Page: 1 2 3 4
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.