table view problem (and solution)
| Project: | dompdf |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Well, experimenting with your module, which encapsulates use of the dompdf library, I ran into a problem printing a table view to pdf.
While dompdf happily accepts theader to repeat the header at the top of each page, it croaks on the tbody tag. Thinks it's a nested table or something and gives out an error (on php 5.2 I got the enigmatic "Fatal error: Nesting level too deep - recursive dependency? in /var/www/dompdf/include/table_frame_decorator.cls.php on line 143".
I solved this by adding the following line inside your dompdf_stream_pdf() function, just before you do the $dompdf->load_html() invocation:
// must get rid of tbody (dompdf goes into recursion)
$html = preg_replace('/<tbody>|<\/tbody>/', '', $html);I don't offer this as a patch, since you may prefer some more elegant theming related solution.
Another problem is with exposed views, where it just prints out the exposed filters table and omits the results, which seems to be a similar issue.
Anyway, am working a lot with dompdf these days and will continue to let you know about problems / solutions as they come up.
Thanks a lot for the great views integration!
Not promising anything in the extreme short term, but hope to integrate with the salesforce module to print out some reports (would be awesome!!!).

#1
Worked for me... thanks! I'll never look at a tbody tag in the same light again.