Hacker News new | comments | show | ask | jobs | submit login

I used Apache Fop (http://xmlgraphics.apache.org/fop/) to convert XML to PDF at a previous job. It was extremely painstaking work. On the other hand, it gives you a lot of fine-grained control over the appearance of your PDF.

I’ve found ODF is a very convenient format for generating documents. It has a little bit of a learning curve, but you can edit your templates in Libre Office and fill it using any kind of simple templating solution.

It really is quite neat — if you define all your styles declaratively then the markup you touch is very clean and simple, e.g. something like this:

    <office:document-content xmlns:office="…" xmlns:text="…">
          <text:p style-name="foo">Bar</text:p>
I’m sure OOXML can be used in a similar manner, but I don’t know that format very well.

I too used Fop at my last $job to generate PDF files. As you said, the source was extremely tedious to write but you can't beat FOP for the precise control. I would first look to other solutions, since they can be faster, but FOP will always come through.

Applications are open for YC Winter 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact