I'm facing a problem generating PDF documents using PDF:writer. My
code generates a couple of dozen documents in a loop. Each contains
something between 8 to 30 tables. Most of the documents generate just
fine, but occasionally, say in one of a dozen documents, one of the
tables gets printed wrongly. The heading of the table is printed with
one column name per page - so if my table has 5 columns, there'll be 5
pages, each with just one column name printed at the top, no data. On
the next page after these, the table will be printed correctly, with
proper header and everything.
Typically this happens to a table that's going to be rolled over
to the next page, just space for one row at the bottom of the page.
However, many other tables in the same situation do get printed
correctly, so that can't be the only reason.
I'm using an older Rails, 1.1.6, but PDF:Writer is 1.1.3. The code
that's generating the table is :
So it turns out this is a known issue with PDF:writer (
http://stonecode.svnrepository.com/ruby_pdf/trac.cgi/ticket/7 ), which
I didn't find before posting. Apologies. In any case, I wrote a
workaround that's fixing the problem for me. Might save a few minutes
for the next one like me, so here it is :