Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I had a similar need at a company I worked for. My solution was actually quite similar to the author's #1 with the major exception being that I used ODG for LibreOffice Draw which mostly solves the author's two main complaints here. Background images can be high quality and placing your text is as easy as clicking where you want to place your text box.

The only other major difference is that I didn't interact with UNO. Since Open Document Format files are zipped XML files I extracted the content.xml and did regular expressions for my variables then replaced them.

We did have to do signatures as well but that turns out to be not THAT much of a pain. If you insert an image on top of your form manually then look at the resulting file you can pretty much copy the part of the XML that refers to the inserted image, insert the signature image into the ODG zip and make sure the names line up and it will work.

It's worth noting that the practice of editing complex XML with regular expressions is not always advisable. In my experience it works fairly reliably with ODG because the format remains simple. But, with ODT it can result in corrupted files quite easily because additional XML can lie inbetween the text letters of your variables. Then you'll be on a mission to find and ignore all the text markup like XML bold markers and span tags and paragraph markers and style tags.... before you know it your simple unzip regex rezip becomes a whole library.



I've had great success with this library:

https://github.com/christopher-ramirez/secretary




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: