Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a form.

Status
Not open for further replies.

calista

Programmer
Jan 24, 2001
545
US
I have developed a form that, for the time being, will have to be printed out and signed. I display the information in tables, but while it looks fine on screen, it's a little scrunched up and the columns don't line up properly when I select the table with my mouse and print it. If I print it landscape, it prints fine. I am assuming this means the width of my table is too wide for the printer. Does anyone know how wide (in px or pt) I can make the tables and still have them print out OK in portrait mode? Calista :-X
Jedi Knight,
Champion of the Force
 
I'm not position of the max but I usually print out
at 580px wide and it works great.

~Dave
 
Calista,
on A4 size paper you can set the table width up to 630, if you set the table on the screen to the same size you can 'preview' your form. If the form on the screen looks good, you'll get a good print.

Erwin
 
Thanks, guys, I got that part. Now, here's the next part of the problem. This is probably a JavaScript thing, but maybe Cold Fusion has a way to do this. I have my page header and footer in Application.cfm and OnRequestEnd.cfm respectively, with means, of course, that they are always displayed. What I'm looking for is a way to convert the page (minus the header and footer) to a printer friendly format. Maybe even convert and print in one click. An example of what I want to do is on Mapblast.com. Once you get your directions or map, you can click a button labeled "Print", and the page is reformated. Then you can hit "Print" on your main toolbar to actually send to the printer. How is this done? Thanks! Calista :-X
Jedi Knight,
Champion of the Force
 
If you have the information on one page you can hide the info you don't want on your printout.
Javascript:
1.create a tag around the information you want to hide
2.create a print button inside the info you want to hide or add id to button
3.use document.all.id_name.innerText = "" ; to hide info
4.use location.reload(true); to show info again.

hope this is helpfull,
Erwin
 
Thanks, erwino. I'm afraid you'll have to bear with me. I'm a complete novice at JavaScript, and still in the beginner approaching imtermediate class in Cold Fusion.

What do you mean by "create a tag around the information you want to hide"? Calista :-X
Jedi Knight,
Champion of the Force
 
Calista,

OK, lets try to explain:
lets say you want to show a header in your file that say's 'this is my page'
You use the html tags <h2>this is my page</h2>
now add an id to the tag, like <h2 id=&quot;header&quot;>
put the rest of the code on the page, include a button that say's print, and in the onclick event of the button you set a function. Let's call the function print_this()
In this function you put the code document.all.header.innerText = &quot;&quot; ;
window.print() ;
and location.reload(true) ; if you want to show the header again.
This will 'rewrite' your page and put instead of the header <h2 id=&quot;header&quot;>this is my page</h2> an empty string.
If you have more text or even images to hide, create a tag like <div id=&quot;header&quot;> </div> to hide a block of text.
Hope this explains it a bit,
Erwin
Erwin
 
OK, I think I follow you, so far, and I see what you mean about having all the code on one page. But, I do not have all the code on one page. My header and footer are displayed by Application.cfm and OnRequestEnd.cfm. How do I work around that? Thank you very much for your help! Calista :-X
Jedi Knight,
Champion of the Force
 
Calista,
do you have these files in the code as <cfinclude template=&quot;Application.cfm&quot;> ? or are they in a frame?
If they are included try to put <div id=&quot;idname&quot;> </div> tags around the include. This will then 'hide' all what is in the include file. (If you have frames you print only the one frame)
Erwin
 
In my Application.cfm page, I CFINCLUDE a page that has the code for the header. I am not using frames. However, I like your solution beter than the one I came up with. I get the name of the page, and if it is NEQ the page I want to print, it prints the header. Clunkly, but it works. Ditto for OnRequestEnd.cfm. Calista :-X
Jedi Knight,
Champion of the Force
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top