Reputation: 192921
I've been asked to write a program which generates reports in the form of PDF files. There are two main dynamic features which have been asked for, which I'm not sure are even possible:
1) The report contains a table with several columns. Users should be able to click on the column header to sort the table rows by the values in that column.
I've never seen a PDF file that users can click on to re-sort table results, but I'm told that this is possible.
2) The report should have a dropdown box which users can select to toggle which rows of the table are displayed or hidden.
I'm fairly sure that this isn't possible to do in a PDF file, though I've been told otherwise.
So my question is, which of these things are even possible, and what library should I use for generating PDF files? (The library can be in any programming language.)
Upvotes: 4
Views: 2611
Reputation: 90213
Have a look at
You can also download a ready-to-study sample PDF with that feature built in.
Upvotes: 2
Reputation: 9
Yes, all of those dynamic features are possible with an XFA PDF form (created in LiveCycle Designer) and scripting ( JavaScript). We have examples of sorting rows in tables and hiding and showing sub-forms at http://www.pdfscripting.com , but you must be a member to access them (not free). You may be able to find free sample files doing an internet search for XFA PDFs or LiveCycle Designer PDFs- not sure but it is possible at any rate.
Dimitri WindJack Solutions http://www.windjack.com
Upvotes: 0
Reputation: 597076
For Java there are the following tools / libraries that are very good and stable: JasperReports - you design your report in a graphical designer and then populate it with data programatically.
The other is iText. It works on the lower lavel (actualy JasperReports is built on top of it for the PDF part), so it might support the requested sorting options.
Upvotes: 1
Reputation: 202
Don't use PDF as a substitute for html/CSS/JavaScript/etc. PDF is best when it's used as an immutable document format, not as a poor man's web page. Sure, you can put your foot in a box and call it a shoe, but it's really just a box.
Upvotes: 2
Reputation: 190925
I would look at Acrobat. There is a JavaScript implementation for it.
http://www.adobe.com/devnet/acrobat/javascript.html
Upvotes: 1