I have some nice forms done using stylesheets. I currently have them
displaying on screen and the user could simply just print.
This works when there is only one form (facility) to be viewed/printed.
I have created the looping code necessary to print for all facilities
but that doesn’t work for me because each page uses stylesheets with
that do absolute positioning and thus each form overlays the
previous forms and it becomes a blurry mess.
When using css, there are styles strictly for printing that allow the
use of ‘page breaks’ but given the format I am doing (viewing on screen
and then printing), this clearly doesn’t work.
So I looked at other methodologies…
HTMLDOC doesn’t support stylesheets
PdfWriter has it’s own markup code
PDF::Writer has it’s own markup code
I suppose the only thing I can do is simply render to print and I
Anybody doing something like this that can push me in a direction?
I guess I may be a bit unclear. Do you have a separate css file for
media=“print”? And it’s not working?
NO - I just have one css file and it’s set for media=‘all’
Does having separate css files for print and screen matter?
Definately. If you try to combine your screen layout rules with your
print rules, I’m not surprised it’s not working. Best practice is to
create a separate stylesheet just for print. There’s a good write up
from Eric Meyer (one of CSS’s creators) at A List Apart.
It might not be a perfect fit for your situation, but it’ll help out
with a lot of the basics.
I still haven’t verified the issue and I will later on - I was able to
get the page break to function not when I split the stylesheets into
separate stylesheets for screen & print but when I made the very first
object on the page NOT use position : absolute; - this is all very
hair splitting stuff.
I do plan on getting back to this and nailing it all down once and for
all and I just wanted to say thanks for the guidance and the direction
to the the interesting information at alistapart.
position:absolute == evil.
On Wed, 2006-03-01 at 00:51 -0800, Ben M. wrote:
position:absolute == evil.
excepting of course, when it works.
I’m new at this…I’m learning and yes, I have discovered the dark
side…call me Anakin.
As it turned out, it really didn’t matter if the media rules were
separate for screen/print or if they were the same and I set the media
type ‘all’, once I fixed the issue of page breaks, it pretty much worked
The issue turned out to be ‘positioning’ as I had set all the
elements to be absolute positioning which meant that page breaks created
new blank pages as opposed to to rendering each form on it’s own page.
The way that I ultimately solved it seemed rather innocuous but it was
effective. The first element to be printed/viewed on the page was an
tag - the logo. I change that to position : relative; and left
everything else set to absolute and that formed each page properly.