Solved

Any way to put printing Page Breaks in html?

Posted on 1998-10-22
5
137 Views
Last Modified: 2010-04-09
I am converting a word .doc to html.  It will probably be printed by the user, and I'd like to force some page breaks when its printed.
Is there any way to do this in HTML?
0
Comment
Question by:clay111296
  • 2
  • 2
5 Comments
 

Expert Comment

by:ap3
Comment Utility
There is an option for IE 4.0x:

<DIV STYLE="page-break-before:always;">&nbsp</DIV>

or

<DIV STYLE="page-break-after:always;">&nbsp</DIV>

This is part of CSS 2.0.  We should see it implemented in the future with Netscape because this standard has been approved by the W3C.
0
 

Author Comment

by:clay111296
Comment Utility
Thanks for the tip. I suspected as much. I'll leave the question open, though.  If enough people do that, eventually the question will be worth 1,000s of points and perhaps someone will develop a solution :-).

BTW, I did find a printer driver program that allows any browser to support page breaks.  
But that's a bit extreme.  Would be easier to put it in .doc format and include a link to the word reader program from M$
0
 
LVL 11

Accepted Solution

by:
RoadWarrior earned 200 total points
Comment Utility
*smiling*
clay, i have been thinking about this a lot recently and that printer driver program may be the only possible way to implement it properly. This is because, on a browser the user may select the base font size, the base style of font etc, even forcing the size with the font tag has different results on different systems, added to that, some people have crusty old 9 pin 120 dpi printers, some people have ultra mega super high quality 1200 dpi laser printers. implementing of page breaks within html means virtually writing a browser that "runs" on a printer. The number of combinations of peoples browser preferences, default display modes, printers and every other thing against us is staggering. There needs to be some standard in there, and it is neither in html which as a "feature" can be displayed pretty well any old how at the user end, or the browsers or the printers or the computer systems of this world. Print formatting needs a high degree of document layout and presentation rigidity that does not exist in html, and may never do. It is not as simple as embedding the formfeed escape code in the document, that would only work if the printing was straight text in the printers own fonts, hardly used, guess you could tell people to print "draft mode" to get the right formatting, almost everything prints in graphics mode though, some people may have their fonts set up on their 1600x1400 screen such that a single sentence overruns a page on their 120x120 dpi printer when printing from a browser.

just off the top of my head here are some of the things that need to be supported in html and hence browsers to allow print formatting..
specifying of point size of type, of style of type including absolute width and leading of characters (failing that a few absolutely standard, same on everything fonts)
specifying line spacing. absolute line spacing in points not relative.
and hard page breaks of course.


i think the best current solution, is to make the file in adobe acrobat .pdf format and provide a link to download the viewer or the plugin, which a lot of people have already, probably more than have microsloth word or a viewer, since there are acrobat viewers for far more platforms than there are word viewers, and the adobe format has been designed to be so rigid as to give the same or substantially similar results on any capable computer/printer combination.

There is one and only one getaround that i can think of and it involves assumption that the user is printing on A4 paper of the size 8.5 ins by 11 ins. We also have to assume margins, at a guess most popular might be around 1/2 ins all round, so count on 7.5x10, be as well to point this out to the prospective user/printer though. One makes an image per page either .gif or .jpg of the text to be printed, with the same aspect ratio as the a4 page, to get a fairly decent print quality one has to make the dpi at the print end about 300 so that is going to give us a huge image size of 2250 x 3000, displayed on the browser with the width property set to 100% i.e.

<img src="http://docimage.jpg" width=100%>

and have no other html on the page, no links, just the pages one after another, no spacing between them. This is going to be a huge download for anyone though.
Having said that, you can make things better by doing it as a 1bit gif, i.e. two colors black and white only, any images dithered, just tried a fairly simple one at that size and it saved  out to a file only 15k, (not much text in it though, a "full" image might not compress so well) BUT that takes 800k unpacked! go more than a few pages per html page and a lot of systems will not cope. So that will work on standard browsers, I am sure someone will correct me if i am wrong but i think at least netscape 2 upward and internet explorer 3 upward *smile* provided you tell the user the paper size and margins to set.

The Future.

Microsoft are producing word, excel etc applications that can save as a web page and publish AND retain original document formatting hidden beneath the HTML so at some time in the future Internet Explorer might take advantage of such formatting to print, but not as yet.

regards,

Road Warrior.
0
 
LVL 11

Expert Comment

by:RoadWarrior
Comment Utility
*smile*
there is also another assumption on that image file method, for it to work, the users printer must be set to a "square" resolution i think, i.e 240x240 or 600x600, not 240x200 or 600x300 or anything like that, though i presume in most cases the driver and browser should correct for that, but having had some wierd prints from my printer when set to 320x240, i would not count on it.
*smiling* also it would be important to tell people to print from the browser, if they save the images separately and print them with something else, then the sizing is at the mercy of their viewer app, that is why we are setting the image width to 100% with html *smile*

Regards.

Road Warrior.
0
 

Author Comment

by:clay111296
Comment Utility
Not a complete solution, but merits a grade.  Thanks for the input.  Giving a 'C' only because it doesn't actually solve the problem, but, rather, reveals no solution exists.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now