Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    Jun 2002
    Location
    Westlake, Ohio, USA
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    print a form on the web

    I have a form on our intranet that I want users to be able to print without printing the entire web page. I would like the user to be able to just click a button that is 'Print Form'. I am using asp pages. Any help would be greatly appreciated. Thanks
    ...

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: print a form on the web

    I have found that the best bet for printable pages is a non-HTML format, such as PDF. HTML-based pages will render differently on different browsers and depending on a number of settings in the user's OS and browser. Non-HTML format is the best way to insure an accurate printout.

    You can create the desired page, even using HTML, then create a PDF of that page. Simply post a link to the PDF file and the user's browser will load the Adobe Acrobat plug-in. You might be sure to place a link to Adobe's Acrobat Reader Download Page, in case the user needs to download it.

    Hope this helps!

  3. #3
    Lounger
    Join Date
    Jun 2002
    Location
    Westlake, Ohio, USA
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: print a form on the web

    I am sorry, I was not clear. This is a form that they are going to fill out on the web. It has radial buttons that the user will select and they want to print the form after they have selected what they want. Thanks
    ...

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: print a form on the web

    The best way to give a printable document is to open a separate window with a more printer-friendly HTML/ASP document. In this case, you'll want the contents of the form with the selected results.

    The problem with doing this *before* submission is that there's no way to generate a server-side page containing the client's entered data if they have not yet submitted. You could use client-side (Javascript) code to read the selected values from the Parent window.

    Just a few thoughts...

  5. #5
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: print a form on the web

    So they fill out this form and you want them to be able to print a copy of it after it's submitted or before? You said they want to print "after they selected what they want" so that sounds like they print before it's submitted.

    At first glance I thought this would not be hard but after some research.... <img src=/S/hmmn.gif border=0 alt=hmmn width=15 height=15> From my google search 'javascript print page' I read several sites that said you can't print a page directly using JavaScript.Instead the best you can do is to display the print dialog (as the user would see via hitting the browser's print button or ctrl+p). This is one of the sites I found, http://www.codeave.com/javascript/code.asp?u_log=7010

    BUT WAIT... My JavaScript book shows that for NS 4 only, you could just call window.print() to do the same as hitting the browser's print button. I tried this myself on IE6 and it worked fine so that seems to be the answer <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

    Deb

  6. #6
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: print a form on the web

    But...!
    I think the original question suggested that only part of the page should be printed, which from my reading means the form is part of a much larger page, the remaining contents of which are not required on the printout. No?

  7. #7
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: print a form on the web

    Ahhh, maybe so. After re-reading the original post, it does state that the form is on a page with other stuff. So as another poster suggested, move the form to its own window and then use JavaScript to print it. If the form stays on the page wtih other items, then the only way I think of is to use JavaScript to parse through the DOM object to fetch the Form part of the page. On second thought... that would extract the fields/data but it still wouldn't let you just print the form, would it? <img src=/S/hmmn.gif border=0 alt=hmmn width=15 height=15>

    I think if he changed it such that the form is in its own window, then print that window, that's the only way accomplish it. Dunno. <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

    After all this, the poster might just let it be as is and just call window.print() to print the entire page anyway. The user may get more stuff printed then they plan but at least they get the all important form. Many sites keep it simple and just tell the user to print it themselves instead of adding code to force the page to the print queue.

    Deb

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: print a form on the web

    CSS lets you designate style classes that have different behaviors for view and for print. For a time, I think MS was using this for certain Technet or Knowledgebase articles, so that extraneous sidebars did not appear on the printouts. Thus, you could separate your page into DIVs and class the ones that shouldn't print as CLASS="NoPrint" and define that as "Display: None" in the PRINT section of your stylesheet and "Display: Block" in whatever that other section is called. (At least, that's what I'd try, but at the moment, I can't.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •