how do you print a textbox???

Discussion in 'Software' started by chris6690, Jul 13, 2009.

  1. chris6690

    chris6690 Private E-2

    How would you go about just printing out what you have written in a text box? It's a multi line text box that can go on for a lot of pages I don't know how to set it up so the user can print it can anyone help me?
    I do know how to print the whole screen but it only prints the form as you see it....
     
  2. Senlis

    Senlis Staff Sergeant

    what programming language are you using?
     
  3. w3d

    w3d Private E-2

    If you want to allow your users to print the contents of a large textbox (ie. <textarea> element) I would (using JavaScript) do the following:

    1. Read the value of the <textarea> element.

    2. Open a new page/window and write the contents of the <textarea> element into a DIV element, perhaps replacing CRLF with <br> in order to preserve line breaks. By not constraining the text (ie. in a free flowing DIV) you should not suffer issues with text being cropped when printed - printer friendly.

    3. Give your user a Print Window link as you would have doen before to print the page.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds