0
votes

We're building a Rails app which enables a user to make their own PDF booklet.

On the PDF document there are fixed height sections for the user to complete via a web form. For example lets say the user has a half page 'About me' section at the bottom of the second page.

What's the best way to limit the text box on the form so that the user can only enter as much text as there is space available on the PDF output?

1
Isn't this a html/javascript question?user596916
Ok, lets say that it is. Suggestions?Evolve
try the 'maxlength-plugin' (jquery plugin) - not used it myself but looks like the sort of thing that would do what you require, probably others around.user596916
The issue in all of this is how many vertical lines it takes up. The problem is that both newlines ('Enter' pressed on the form), and text wrapping will both directly affect the total number of lines. This can be hard to programmatically calculate something that will fit within the PDF.istrasci

1 Answers

0
votes

Couldn't find an elegant way to do this with Prawn. Suggest just to add a javascript character count which the users sees as they type, like how twitter does it.