tags:

views:

50

answers:

3

Edit: I am using domPDF 0.5.1, hosted http://code.google.com/p/dompdf/

I am using HTML table to generate boxes inside which I place one character each, eg. the following table contains the name "kinjal dixit"

<table>
<tr>
<td>k</td><td>i</td><td>n</td><td>j</td><td>a</td><td>l</td>
<td>&nbsp;</td>
<td>d</td><td>i</td><td>x</td><td>i</td><td>t</td>
</tr>
</table>

there is a style rule like the following:

table tr td {
  border: 1px solid black;
  height: 2em;
  width: 2em;
  font-family: monospace;
}

When viewing this in a browser, the cell with the space appears the same size as the other cells, but when generating a pdf, the cell with the space appears 'squashed'.

Does anyone have a solution to this?

Edit: in the style, addition to em, i have tried pt and px. In all cases, when viewed in the browser it appears okay, but when converted to pdf, it does the same thing.

Edit: The dompdf library uses something called "R&OS CPDF" class by default. There is a way to configure PDFLib. I am reading on that.

A: 

Try using &nbsp; instead of just leaving the cell empty.

Sabeen Malik
A: 

Solved (=hacked?)

changed:

<td>&nbsp;</td>

to:

<td>&nbsp; &nbsp;</td>

(there is a space between the two nbsp)

and it worked.

kinjal
A: 

DOMPDF 0.5.1 strips non-breaking spaces from text. The 0.6.0 release (currently in beta) addresses this issue.

Compare this render from 0.5.1 with this one from 0.6.0 beta 1

BrianS