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

Printer Formatting Help

Status
Not open for further replies.

dakota81

Technical User
May 15, 2001
1,691
US
Here's the page I am trying to allow to be printable in the format I want:



First I want the background image to be printed without having to check the option in the properties to print backgrounds. Like have the image set up as a layer positioned behind the text maybe?

Second I want to have page breaks between pages so that both the background image & the text have a page break.


Getting the page breaks between the text is easy, and I did try inserting an absolutely positioned image with a negative valued z-index for each page, and the image defaulted as showing in the printout, but did not follow the page-break rules (I assume becuase it was absolutely positioned).

Any thoughts?


We print out our actual invoices a different way, so I don't need any advice on that front.
 
Oh, and to add, I have no plans whatsoever to make this cross-browser compatible. Internet Explorer only is good enough for this.
 
Why don't you create PDFs of those pages, that way they will print exactly as you want, with ANY browser, on any system.

if you don't have Adobe Acrobat, has an excellent free utility that will create PDFs from any application.

When in doubt, deny all terms and defnitions.
 
I might look into creating .pdf files, but regardless I'd still like to find out if I can make this page work through straight html & css or if it can't be done with the current technology.
 
AFAIK, you cannot change IE's settings from a webpage, that is, you cannot make IE print the background unless the user has specifically selected that option in their prefs.

You would likely have to use an image as a layer for it to print, you are on the right track there.

Try this to force page breaks, put this is the header or in your stylesheet.

<STYLE TYPE=&quot;text/css&quot;>
H2 {page-break-before: always}
</STYLE>

This will produce a print page break before each H2 on the page.


When in doubt, deny all terms and defnitions.
 
I have used this before to print out watermarks...
<style media=&quot;print&quot;>
.myBackground{
display:inline;
border:0px;
color: #999999;
width:100%;
text-align:center;
}
</style>
Haven't tried it using a background-url image, but maybe it's an idea.

Hope this helps,
Mickey
 
I am able to absolutely position the image and using the z-index propery have it as the background, and that way the image does print out on the pages. However, I cannot force a page break on the absolutely positioned object; as shown in this modification (view in IE only):


And I tried out the pdf creater, and it just takes what IE would print out & creates pages from that; so no forward progress there.
 
Alright, I'm coming to the conclusion that this just will never work, and that's just sad. I think there's going to be a lot of added printing functionality if CSS3 ever gets implemented, but who knows how long that will take...

However, the last possibility might be to somehow enable printing the background images through script. I've worked with the ScriptX plugin that gives me page setup options; is there something else that can adjust the setting for enabling printing a background on this single page?
 
Did you try my suggestion? I don't know if I was clear.

If you put this in the HEAD:

<STYLE TYPE=&quot;text/css&quot;>
H2 {page-break-before: always}
</STYLE>

You can change the H2 to any tag, just use one that you don't use anywhere else in the page, that was why I decided on H2... you can format H2 to any appearance.. but this should force a page break when printing without problem.

When in doubt, deny all terms and defnitions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top