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
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
print a form on the web
Home » Forums » Developers, developers, developers » Web design and development » print a form on the web
- This topic has 14 replies, 5 voices, and was last updated 21 years, 1 month ago.
AuthorTopicWStimelord
AskWoody LoungerMarch 3, 2004 at 7:57 pm #401738Viewing 1 reply threadAuthorReplies-
WSMarkJ
AskWoody LoungerMarch 4, 2004 at 2:25 am #793995I 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!
-
WStimelord
AskWoody Lounger -
WSMarkJ
AskWoody LoungerMarch 4, 2004 at 4:15 pm #794281The 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…
-
WSMarkJ
AskWoody LoungerMarch 4, 2004 at 4:15 pm #794282The 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…
-
WSjujuraf
AskWoody LoungerMarch 5, 2004 at 6:07 pm #795129So 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….
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
Deb
-
WSLeif
AskWoody Lounger -
WSjujuraf
AskWoody LoungerMarch 5, 2004 at 6:59 pm #795167Ahhh, 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?
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.
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
-
WSjujuraf
AskWoody LoungerMarch 5, 2004 at 6:59 pm #795168Ahhh, 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?
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.
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
-
-
WSLeif
AskWoody Lounger
-
-
WSjujuraf
AskWoody LoungerMarch 5, 2004 at 6:07 pm #795130So 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….
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
Deb
-
WSjscher2000
AskWoody LoungerMarch 7, 2004 at 7:51 am #795618CSS 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.)
-
WSjscher2000
AskWoody LoungerMarch 7, 2004 at 7:51 am #795619CSS 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.)
-
-
WStimelord
AskWoody Lounger
-
-
WSMarkJ
AskWoody LoungerMarch 4, 2004 at 2:25 am #793996I 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 -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
3 hours, 8 minutes ago -
Office apps read-only for family members
by
b
5 hours, 44 minutes ago -
Defunct domain for Microsoft account
by
CWBillow
2 hours, 36 minutes ago -
24H2??
by
CWBillow
42 minutes ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
14 hours, 30 minutes ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
7 hours, 43 minutes ago -
TotalAV safety warning popup
by
Theodore Nicholson
2 hours, 33 minutes ago -
two pages side by side land scape
by
marc
2 days, 3 hours ago -
Deleting obsolete OneNote notebooks
by
afillat
2 days, 5 hours ago -
Word/Outlook 2024 vs Dragon Professional 16
by
Kathy Stevens
1 day, 8 hours ago -
Security Essentials or Defender?
by
MalcolmP
1 day, 11 hours ago -
April 2025 updates out
by
Susan Bradley
6 hours, 14 minutes ago -
Framework to stop selling some PCs in the US due to new tariffs
by
Alex5723
1 day, 4 hours ago -
WARNING about Nvidia driver version 572.83 and 4000/5000 series cards
by
Bob99
18 hours, 42 minutes ago -
Creating an Index in Word 365
by
CWBillow
1 day, 21 hours ago -
Coming at Word 365 and Table of Contents
by
CWBillow
9 hours, 17 minutes ago -
Windows 11 Insider Preview Build 22635.5170 (23H2) released to BETA
by
joep517
3 days ago -
Has the Microsoft Account Sharing Problem Been Fixed?
by
jknauth
3 days, 4 hours ago -
W11 24H2 – Susan Bradley
by
G Pickerell
3 days, 5 hours ago -
7 tips to get the most out of Windows 11
by
Alex5723
3 days, 3 hours ago -
Using Office apps with non-Microsoft cloud services
by
Peter Deegan
2 days, 21 hours ago -
I installed Windows 11 24H2
by
Will Fastie
1 day, 3 hours ago -
NotifyIcons — Put that System tray to work!
by
Deanna McElveen
3 days, 9 hours ago -
Decisions to be made before moving to Windows 11
by
Susan Bradley
2 hours, 42 minutes ago -
Port of Seattle says ransomware breach impacts 90,000 people
by
Nibbled To Death By Ducks
3 days, 17 hours ago -
Looking for personal finance software with budgeting capabilities
by
cellsee6
3 days, 1 hour ago -
ATT/Yahoo Secure Mail Key
by
Lil88reb
3 days, 2 hours ago -
Devices with apps using sprotect.sys driver might stop responding
by
Alex5723
4 days, 10 hours ago -
Neowin – 20 times computers embarrassed themselves with public BSODs and goofups
by
EP
4 days, 19 hours ago -
Slow Down in Windows 10 performance after March 2025 updates ??
by
arbrich
18 hours, 42 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.