4

I am writing a desktop application in Java, which has all of the Airband radio frequencies for the UK in it.

I would like to make this frequency database downloadable so people can print it. Would it be best to create the database in XML or use PDF for the download to print? Or perhaps there is another, better option?

Matt Ellen
  • 3,368
NeonLinux
  • 308

5 Answers5

11

First thing, the storage format is almost never the same as the print format (unless there's a very good reason).

XML for storing data is OK, and PDF isn't. XML for printing is not as good - it isn't really very print-friendly. PDF is a better choice for print. It may have a steeper learning curve, but your output will be much nicer. iText is a popular PDF library for Java.

9

Why don't you use a simple CSV file?

It's easy to manipulate this file format through programming (there's a ton of libraries) and can be open by most spreadsheet applications.

5

If you want other people to use these radio frequencies in their own applications, store them in a well-formed XML (and include a schema as well). If you just want them to be referred to (i.e. display-only), a PDF or other document would suffice.

Bernard
  • 8,869
5

I'd just use HTML. It can be formatted for printing using CSS, a table can be copy-pasted into a spreadsheet, it's an open format and it's easy to generate.

1

Store the data in the database's native, natural format, whatever it is - table of types that match the values, float for frequency, varchar for name etc.

Extract the data from the database in whatever format is comfortable to transport and process. JSON tends to be much easier to process than XML.

Parse the data on client side and present as a nice HTML table in a neat printer-friendly HTML page. You can even include a nice "Print" button and make it invisible by @media:print{ #printbutton{display:none;} }

Don't lock down access to the list-producing script, allow other pages or engines to pull data from it and keeping it straightforward, so that people who want it in other media than printing your page can use it too - say, auto-update channel list in a web-enabled radio.

SF.
  • 5,236