Text in table has a length limit?

12 views
Skip to first unread message

六翼天使

unread,
Jun 24, 2010, 12:57:28 AM6/24/10
to Prawn
Like this:

table
[ ['123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890',
'John Doe', '4.2', '125.00', '525.00'],
['01/12/2008', 'Jane Doe', '3.2', '75.50',
'241.60'] ]

It wont generate a PDF. The limit size is about 80 characters. How can
i use a long string then:(

Brad Ediger

unread,
Jun 24, 2010, 1:39:08 AM6/24/10
to prawn...@googlegroups.com
2010/6/23 六翼天使 <hexa...@gmail.com>:

Probably the most straightforward thing to do is to break up the text
yourself, as you want it to be split. If you have one word big enough
that it can't fit on a page without being broken, I think it's best to
leave your application in charge of the line breaking.

-be

六翼天使

unread,
Jun 24, 2010, 1:51:03 AM6/24/10
to Prawn
i'm afraid it is not the reason. i tried this:

table
[ ['1234 567890 12345 67890 12345678 90 12345678 90 1234 567890 123456
7890 12345 67890 123­456 7890 1234567 890',
'John Doe', '4.2', '125.00', '525.00'],
['01/12/2008', 'Jane Doe', '3.2', '75.50',
'241.60'] ]

and it doesnt work, either.

------
if you don't mind, would you please show me your code where you meet
long text in a table? Thanks a lot...

Brad Ediger

unread,
Jun 24, 2010, 1:29:45 PM6/24/10
to prawn...@googlegroups.com
2010/6/24 六翼天使 <hexa...@gmail.com>:

> i'm afraid it is not the reason. i tried this:
>
> table
> [ ['1234 567890 12345 67890 12345678 90 12345678 90 1234 567890 123456
> 7890 12345 67890 123-456 7890 1234567 890',

> 'John Doe', '4.2', '125.00', '525.00'],
> ['01/12/2008', 'Jane Doe', '3.2', '75.50',
> '241.60'] ]
>
> and it doesnt work, either.
>
> ------
> if you don't mind, would you please show me your code where you meet
> long text in a table? Thanks a lot...

What version of prawn are you using with that code? The latest git
version of prawn supports this just fine, because it's based on Daniel
Nelson's excellent text refactoring work. I have a feeling that the
version of prawn you're using doesn't have such great line wrapping
capability.

If I were you, I'd either try bumping prawn to a later version or git
master (if you're OK with tracking bleeding-edge code that might
change), or figure out how to manually break the lines yourself
(inserting newlines into the string you pass to Prawn).

Hope this helps,
-be

六翼天使

unread,
Jun 24, 2010, 10:10:16 PM6/24/10
to Prawn
Thank you for the reply.
But i think you've misundertood my question. it isn't a wrapping
problem. if i use a long string in a table, no PDF will be created

I'm using Prawn 0.8.4, and i "gem install prawn" several times, so i
think it is already the latest version...
On 6月25日, 上午1时29分, Brad Ediger <b...@bradediger.com> wrote:
> 2010/6/24 六翼天使 <hexaw...@gmail.com>:

六翼天使

unread,
Jun 24, 2010, 10:45:10 PM6/24/10
to Prawn
Errr, i was wrong... it is just a wrap problem...Thank you very much!

On 6月25日, 上午1时29分, Brad Ediger <b...@bradediger.com> wrote:
> 2010/6/24 六翼天使 <hexaw...@gmail.com>:
>
Reply all
Reply to author
Forward
0 new messages