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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print in ASP, VBScript?

Status
Not open for further replies.

TheBugSlayer

Programmer
Sep 22, 2002
887
US
Hi guys. Hi have an ASP page that displays some reports. The thing is that when you print the reports they broken in no particular order. I basically want to format my pages by records with header and footer and print line by line myself. How do I achieve that in ASP/VBScript? Thank you so much.
 
You can get a long way by writing a style sheet specifically for print. You can pick font sizes and column widths and background colors for print independently of the screen. A great book is "Eric Meyer on CSS.
 
Thanks Clayton. But I'd rather code it for now. What I am trying to do basically is to print only data from one record on a page, introduce a page break when there is more than one and print header/footer on each. SInce the number of lines for each record is variable I am not too sure if CSS can help me.
 
You need to create a "Printer Friendly" version of the report. You can then use simple HTML tables to format the report as you want.

Brad Williams
Webmaster

 
My problem is how to break the report into pages. Let's say I have made up the pages- 80 lines per page, if a record has less than 80 then break the page and start next record on a new one. How do I display that so that when it is printed one page goes on one sheet of paper? Do I display each page on a different HTML page or all the pages into one HTML pages and the printer takes care of the rest?
 
insert this line in the code where ever you want the break.

<p style="page-break-after: always">


VJ
 
VJ,
I tried but the page break doesn't happen, neither on the web page nor on the printed one. I even added a closing </p> tag to no avail

Thanks.
 
Did you place it in the proper place. if you had placed it in the correct place then it should definitely work.

may be you should check your conditions and loops.

I use to print information of employees in our organization and i made the printer to start printing a new page when ever the department changes.

Can you post your code.

-VJ

 
Oh, I got it to work. The text needed to go between the tags, as is customary.

I am not a web developer but I would waste too much time waiting for them.

Thanks much.
 
And one morething ...

you cannot view the page break on the Webpage. The printer takes of this business.

Thanks

VJ
 
I have a similar problem... I have a webpage that is a collection of tables, one after the other. I do not want a table to ever be spanned across two pages. How can I prevent a page break from occuring during the table? I have tried to put a "page-break-inside: avoid;" inside of the table and putting the table inside a <DIV STYLE="page-break-inside: avoid;">TABLE...</DIV> but I still get page breaks inside of the table! Any help is appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top