21 March 2013

There is a long-standing challenge to converting tables to PDF. A quick search (7.7 million results) locates threads going back to 2009 and beyond with people discussing the various awful problems they encounter when converting to PDF. So we are not alone with the problem. Here is a summary of what I've discovered from past experience, some testing, and confirmation in various search results.

  1. PDFs are rendered inconsistently. If your primary concern is printability, then zoom in on the PDF. Frequently, missing lines are simply not appearing when you are zoomed out too far (e.g., details disappear when you view a full page depending on screen resolution).
  2. Borders appear much more reliably when you do NOT use shading. This includes a white background. If you set it to "no color", then the borders will frequently appear correctly. Obviously, choosing between shading and borders is not ideal. The sliver of white next to the border on the screenshots is one way that the shading-border conflict presents itself. 
  3. The shading-border relationship can be improved by setting the cell margins to 0. The notch in the border (see screenshot) corresponds to the amount of cell margin. By seting it to 0, you can eliminate (or nearly eliminate) that sliver. Of course, it also results in content coming into contact with the border, which makes this solution inappropriate in some situations.
  4. One half-measure that can work is to use a border color that matches your shaded rows. That keeps the table boxed. However, it does not segment adjacent shaded rows or provide the nice sharp line between shaded rows.

In the end, it does not appear that there is any point to banging your head against the wall if a table does not export well to PDF. You live with the limitation, apply one or more mitigation techniques above, or dramatically change your formatting to account for the problem.

Technologies:


blog comments powered by Disqus