Wondering how to build the loops for this table formatting

I’m trying to recreate a “ballot” in an HTML table.
The PDF version of the ballot (from the 2008 election) is located here:
http://174.120.31.194/~eshipman/Precinct0015.pdf

I need it to look like this:
http://174.120.31.194/~eshipman/sub.htm
(a mockup from the customer, I am programming the back end.)

The problem lies in the fact that I don’t know where to “break” columns.
I am returning the elections in separate arrays, i.e.
PRESIDENT
CONGRESSIONAL
COUNTY
NONPARTISON

It’s just figuring how to break the columns has got me stumped.

Any ideas?