[LRUG] Best way to generate a PDF

Richard Livsey richard at livsey.org
Tue Feb 12 07:39:40 PST 2013


I can't speak for PDFKit/wkhtmltopdf, but Flying Saucer supports pagination and page numbering etc…  

You can use all the page-break properties in CSS:
http://flyingsaucerproject.github.com/flyingsaucer/r8/guide/users-guide-R8.html#xil_37

It supports the paged media CSS3 module so you can do stuff like  

@page {  
  @top-right { content: "Page " counter(page); }

}


More detail on that can be found here:
http://www.w3.org/TR/css3-page/#margin-boxes  

Cheers.


On Tuesday, 12 February 2013 at 15:28, Luke Saunders wrote:

> Hi all
>  
> Thanks for the suggestions. In my case I assume it's not an option to go via HTML as there is not really a concept of pages in HTML. So things like a separate title page, repeated headers, page numbers etc would be tricky right?
>  
> Cheers,
> Luke
>  
> On Tue, Feb 12, 2013 at 3:18 PM, Richard Livsey <richard at livsey.org (mailto:richard at livsey.org)> wrote:
> > I've had good results with using Flying Saucer - https://code.google.com/p/flying-saucer
> >  
> > It's Java, but easy to use with JRuby or just make a standalone executable and call out to that to generate PDFs from HTML & CSS.
> > I found it much better than wkhtmltopdf for the kind of PDFs I was generating, but probably worth giving PDFKit a try first to see if that suits your needs.
> >  
> > Cheers.
> >  
> > --
> > Richard Livsey
> > Co-Founder, MinuteBase
> > Meeting collaboration made easy
> > http://minutebase.com
> > +44 (0) 7841 260 797 (tel:%2B44%20%280%29%207841%20260%20797)
> >  
> >  
> > On Tuesday, 12 February 2013 at 15:12, Mooktakim Ahmed wrote:
> >  
> > > Hey,
> > >  
> > > Recently i have used https://github.com/pdfkit/PDFKit. One good thing about it is that you can set it up as a middleware which translates HTML into PDF just by going to the .pdf extension.
> > > It might not be good fit for you. But for me, it was a nice way to quickly get PDF generation working, without adding too much messy code. Especially good if you need to convert HTML to PDF.
> > >  
> > >  
> > >  
> > > Regards,
> > > Mooktakim Ahmed
> > >  
> > > On 12 February 2013 15:06, Luke Saunders <luke at sketchconsulting.com (mailto:luke at sketchconsulting.com) (mailto:luke at sketchconsulting.com)> wrote:
> > > > Hi LRUG
> > > >  
> > > > Can anyone with recent experience in this recommend the best tool to use in order to generate a PDF from a Ruby (Rails) app?
> > > >  
> > > > Said PDF will be an A4 document, with a title page, followed by 5-10 content pages each with a standard header / footer including page numbers. Content pages consist of headings and paragraphs, along with some embedded images.
> > > >  
> > > > I used prawn (https://github.com/prawnpdf/prawn) once to generate a business card sized PDF and that was fine, but I'm wondering if perhaps a markup, maybe like LaTeX would be wise to generate this kind of doc.
> > > >  
> > > > Keen to make the right choice and I think making the wrong choice could eat a lot of time here.
> > > >  
> > > > Thanks!
> > > > Luke.
> > >  
> >  
> >  
> >  
> > _______________________________________________
> > Chat mailing list
> > Chat at lists.lrug.org (mailto:Chat at lists.lrug.org)
> > http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>  






More information about the Chat mailing list