Hacker News new | ask | show | jobs
by rad_gruchalski 1424 days ago
12 years ago, I was working on a contract for an aircraft spares supplier. One of the hard requirements: all sales invoices, purchase orders, quotations, invoices, and so on, had to be printed AND available as PDF.

The solution was to use JasperReports. The business could design their templates in a iReport Designer, test with dummy data, put the jrxml templates in a dedicated storage, and a simple http call would merge the real data with the template in a java service (200 lines of code) resulting in a PDF. That PDF would then get printed using ColdFusion cfprint (those huge multi-source laser printers with 10 different drawers). It was worth spending £800 for CF just for the cfprint stuff.

Hundreds of these were printed and generated every day.

2 comments

> had to be printed AND available as PDF.

You just reminded me of a customer I was working for as a junior ERP consultant. They required us to have the proof a document was printed by a user.

I went far down the rabbit hole trying to come up with an end-to-end solution involving cryptographically signed messages sent to the printer, a physical QR code on the document to be scanned back for validation, and others convoluted half-backed contraptions. But I couldn't find an unhackable way to reconcile the state in the machine with the reality of the physical world.

A senior consultant solved it in 10 minutes. Showed them. They were ecstatic and we were paid.

What has he done? Just updated a "printed" column in the database to "True" when the user clicked the HTML "print" button.

In this case, the business owner would go through every printed document that landed on his desk. He really did, every day… it had to be printed, otherwise it did not exist.

Regardless what we think about it, the man was driving a Zonda and his garage has seen a couple of Koenigseggs, and I still build software.

Sounds like he had some sort of business discipline. Or worse, couldn't delegate and had to double-check everything by hand. Paper was his medium of choice in which he felt productive for this particular task.

In my case I'm pretty sure the owners didn't care about the printed documents and never checked them. It was just required to have a proof because... process.

That's when I understood ERPs were not about software but workflow. Not a solution either, but a symptom. Some requirements are bullshit, because nobody has the time (or mandate) to question the sacred Process.

I quit doing ERPs not long after that.

> The solution was to use JasperReports.

Ran into it in a legacy project a few years ago, it was a total mess.

The way the templates were written wasn't clear in regards to how the fields will be filled out, conditions and scripts for the visibility of certain sections were problematic (no proper linting/syntax checks outside of runtime), there were problems with system fonts, there were problems with selecting data for filling out the templates, there were problems with the template files looking broken in different versions of the GUI software, there were problems with getting like 50 warnings after opening the template and moving any element a few pixels broke the entire template.

If possible, I'll avoid the technology, especially after trying to migrate the project to JDK 11 broke because of incompatibilities of that version of the library. Personally, I think that HTML output that then can be rendered to PDF is the only decent option in this space, which will save you many headaches.

I’ve never used Jaspersoft, only seen the marketing pages of recent years on Tibco’s site. But much of that developer experience sounds like my 4-ish years with BIRT: differing versions of the designer GUI in Eclipse breaking things; debugging a report required starting up our entire monolith app.

How much better is SSRS in these aspects than the aforementioned Java-based solutions? Or I guess “paginated reports” in Power BI nowadays.