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, 2 months 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
-
Trump signs Take It Down Act
by
Alex5723
7 hours, 19 minutes ago -
Do you have a maintenance window?
by
Susan Bradley
7 hours, 45 minutes ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
8 hours, 53 minutes ago -
Success Knows No End in the World of Online Slots (Awaiting moderation)
by
isobelhartmann1
9 hours, 2 minutes ago -
Cox Communications and Charter Communications to merge
by
not so anon
10 hours, 39 minutes ago -
Help with WD usb driver on Windows 11
by
Tex265
15 hours, 49 minutes ago -
hibernate activation
by
e_belmont
19 hours, 34 minutes ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
23 hours, 22 minutes ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
1 day, 2 hours ago -
Windows 11 Insider Preview build 26120.4151 (24H2) released to BETA
by
joep517
1 day, 2 hours ago -
Fixing Windows 24H2 failed KB5058411 install
by
Alex5723
34 minutes ago -
Out of band for Windows 10
by
Susan Bradley
1 day, 7 hours ago -
Giving UniGetUi a test run.
by
RetiredGeek
1 day, 14 hours ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
1 day, 21 hours ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
7 hours, 49 minutes ago -
Auto Time Zone Adjustment
by
wadeer
2 days, 2 hours ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
1 day, 23 hours ago -
Manage your browsing experience with Edge
by
Mary Branscombe
41 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
16 hours, 56 minutes ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
23 hours, 20 minutes ago -
Apps included with macOS
by
Will Fastie
21 hours, 12 minutes ago -
Xfinity home internet
by
MrJimPhelps
17 hours, 59 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
1 day, 19 hours ago -
Debian 12.11 released
by
Alex5723
2 days, 23 hours ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
3 days, 3 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
2 days, 6 hours ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
10 hours, 10 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
3 days, 20 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
3 days, 10 hours ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
1 day, 8 hours 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.