• print a form on the web

    Author
    Topic
    #401738

    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

    Viewing 1 reply thread
    Author
    Replies
    • #793995

      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!

      • #794135

        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

        • #794281

          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…

        • #794282

          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…

        • #795129

          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…. hmmn 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%5B/url%5D

          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 clapping

          Deb

          • #795139

            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?

            • #795167

              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? hmmn

              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. brickwall

              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

            • #795168

              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? hmmn

              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. brickwall

              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

          • #795140

            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?

        • #795130

          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…. hmmn 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%5B/url%5D

          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 clapping

          Deb

        • #795618

          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.)

        • #795619

          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.)

      • #794136

        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

    • #793996

      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!

    Viewing 1 reply thread
    Reply To: print a form on the web

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: