word wrapping not working

22 views
Skip to first unread message

fiend

unread,
Sep 11, 2008, 3:05:26 PM9/11/08
to Ruby on Rails: RFPDF
I was curious if anyone else has had problems with RFPDF not doing
word wrapping for rendered HTML?

Early on when I was learning to use RFPDF, I made a sample PDF that
used the write_html method to do some simple output. I noticed then
some strange absence of functionality, where sometimes some HTML I
entered would not produce the same output in the PDF as it would in a
normal HTML document. Namely, the rows were much bigger than they
should be, as if I provided a cell padding, which I didn't.

Now I'm using Edwin Moss' ActiveScaffold fork on GitHub which includes
ActiveScaffoldTools. AST will take the data from the scaffold view and
generate an RHTML document, building its tables using HTML, and send
it to RFPDF. The HTML here at least produced somewhat expected output
(no cell padding), but there's no word wrapping! By standard, <TR>
word wraps unless "nowrap" is provided as an attribute, which it is
not. All rows in the table span only one line of text. I feel like I
can't blame AST here, I looked at the code and the table is generated
using only HTML and ruby tags to insert data. No reason why it
shouldn't word wrap, since that is what <TABLE>,<TR> and <TD> do in
HTML. Any clues?

I might also add the model I wrote my app after, DRY Scaffold (http://
dry.4thebusiness.com/companies) will only let you enter in so many
characters for each field, so when the PDF is generated, it prevents
any line of text to ever reach or surpass the width of the cell. Kind
of sounds like they had trouble with word wrapping too...

Environment:
- Ruby 1.8.6
- Rails 2.1.0
- Edwin Moss' ActiveScaffold v1.1.1 fork (includes AST)
- lastest relase of RFPDF on GitHub, with TCPDF version 1.53.0.TC031


Thanks in advance

fiend

unread,
Oct 8, 2008, 1:47:34 PM10/8/08
to Ruby on Rails: RFPDF
Well, for those of you who might have the same problem, guess what...
there is no word wrapping! Apparently RFPDF has NO support for it.
They have word wrapping for "write text" which only wraps around the
margin of the page. The "Cell" function, which is what the TR, TD
table stuff in HTML is translated to in RFPDF, does NOT word wrap.

However, I am currently working a fork that will support word
wrapping, and I will be sure to share it with the community and post
the link (probably to GitHub) on here.
Reply all
Reply to author
Forward
0 new messages