Print Textarea - Full Length (Height)?

I have a web form that my client wants users to print. It works fine with a little CSS styling, however I have a few fields textaear. If the user prints more than the height of the text field, the type is cropped when printing.

I tried textarea{height:100%;}, and textarea{height:auto;}in the plot style table, but none of them does not work.

Is there a way to resize the textarea field to text size for the print-only version? I would prefer, if possible, a CSS solution that I can insert into my print stylesheet. If this is not possible, a javascript solution will work.

Screenshot Comparison:

Screen vs Print

: JS , - .

+3
2

firefox.

html chrome textarea. script textarea.

:

  • HTML Chrome.
  • Ctrl + P.
  • "" ( PDF).
  • PDF (. textarea , , )
  • "".
0

( JS this jQuery):

function resizeAndPrint() {   
    var _print = window.print;
    window.print = function() {
        $('textarea').each(function() {
            $(this).height($(this).prop('scrollHeight'));
        });
        _print();
    }
    window.print();
}
0

All Articles