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 <div> 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 haven''t a clue on how to do that (client side javascript?) or render to file. Anybody doing something like this that can push me in a direction? Craig
I guess I may be a bit unclear. Do you have a separate css file for media="print"? And it''s not working? Regards, Ben Vaughan On 2/27/06, Craig White <craigwhite@azapple.com> wrote:> 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 > <div> 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 > haven''t a clue on how to do that (client side javascript?) or render to > file. > > Anybody doing something like this that can push me in a direction? > > Craig > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
NO - I just have one css file and it''s set for media=''all'' Does having separate css files for print and screen matter? Craig On Mon, 2006-02-27 at 21:20 -0700, Ben Vaughan wrote:> I guess I may be a bit unclear. Do you have a separate css file for > media="print"? And it''s not working? > > Regards, > Ben Vaughan > > On 2/27/06, Craig White <craigwhite@azapple.com> wrote: > > 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 > > <div> 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 > > haven''t a clue on how to do that (client side javascript?) or render to > > file. > > > > Anybody doing something like this that can push me in a direction? > > > > Craig > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
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. http://www.alistapart.com/articles/goingtoprint/ It might not be a perfect fit for your situation, but it''ll help out with a lot of the basics. Regards, Ben Vaughan On 2/27/06, Craig White <craigwhite@azapple.com> wrote:> NO - I just have one css file and it''s set for media=''all'' > > Does having separate css files for print and screen matter? > > Craig > > On Mon, 2006-02-27 at 21:20 -0700, Ben Vaughan wrote: > > I guess I may be a bit unclear. Do you have a separate css file for > > media="print"? And it''s not working? > > > > Regards, > > Ben Vaughan > > > > On 2/27/06, Craig White <craigwhite@azapple.com> wrote: > > > 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 > > > <div> 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 > > > haven''t a clue on how to do that (client side javascript?) or render to > > > file. > > > > > > Anybody doing something like this that can push me in a direction? > > > > > > Craig > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails
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 <div> 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. Craig On Mon, 2006-02-27 at 22:08 -0700, Ben Vaughan wrote:> 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. > > http://www.alistapart.com/articles/goingtoprint/ > > It might not be a perfect fit for your situation, but it''ll help out > with a lot of the basics. > > Regards, > Ben Vaughan > > On 2/27/06, Craig White <craigwhite@azapple.com> wrote: > > NO - I just have one css file and it''s set for media=''all'' > > > > Does having separate css files for print and screen matter? > > > > Craig > > > > On Mon, 2006-02-27 at 21:20 -0700, Ben Vaughan wrote: > > > I guess I may be a bit unclear. Do you have a separate css file for > > > media="print"? And it''s not working? > > > > > > Regards, > > > Ben Vaughan > > > > > > On 2/27/06, Craig White <craigwhite@azapple.com> wrote: > > > > 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 > > > > <div> 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 > > > > haven''t a clue on how to do that (client side javascript?) or render to > > > > file. > > > > > > > > Anybody doing something like this that can push me in a direction? > > > > > > > > Craig > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
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 for both. The issue turned out to be ''positioning'' as I had set all the <div> 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 <img> tag - the logo. I change that to position : relative; and left everything else set to absolute and that formed each page properly. Thanks Craig On Mon, 2006-02-27 at 22:08 -0700, Ben Vaughan wrote:> 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. > > http://www.alistapart.com/articles/goingtoprint/ > > It might not be a perfect fit for your situation, but it''ll help out > with a lot of the basics. > > Regards, > Ben Vaughan > > On 2/27/06, Craig White <craigwhite@azapple.com> wrote: > > NO - I just have one css file and it''s set for media=''all'' > > > > Does having separate css files for print and screen matter? > > > > Craig > > > > On Mon, 2006-02-27 at 21:20 -0700, Ben Vaughan wrote: > > > I guess I may be a bit unclear. Do you have a separate css file for > > > media="print"? And it''s not working? > > > > > > Regards, > > > Ben Vaughan > > > > > > On 2/27/06, Craig White <craigwhite@azapple.com> wrote: > > > > 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 > > > > <div> 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 > > > > haven''t a clue on how to do that (client side javascript?) or render to > > > > file. > > > > > > > > Anybody doing something like this that can push me in a direction? > > > > > > > > Craig > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
position:absolute == evil. b Craig White wrote:> 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 > for both. > > The issue turned out to be ''positioning'' as I had set all the <div> > 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 > <img> tag - the logo. I change that to position : relative; and left > everything else set to absolute and that formed each page properly. > > Thanks > > Craig > > On Mon, 2006-02-27 at 22:08 -0700, Ben Vaughan wrote: > >>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. >> >>http://www.alistapart.com/articles/goingtoprint/ >> >>It might not be a perfect fit for your situation, but it''ll help out >>with a lot of the basics. >> >>Regards, >>Ben Vaughan >> >>On 2/27/06, Craig White <craigwhite@azapple.com> wrote: >> >>>NO - I just have one css file and it''s set for media=''all'' >>> >>>Does having separate css files for print and screen matter? >>> >>>Craig >>> >>>On Mon, 2006-02-27 at 21:20 -0700, Ben Vaughan wrote: >>> >>>>I guess I may be a bit unclear. Do you have a separate css file for >>>>media="print"? And it''s not working? >>>> >>>>Regards, >>>>Ben Vaughan >>>> >>>>On 2/27/06, Craig White <craigwhite@azapple.com> wrote: >>>> >>>>>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 >>>>><div> 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 >>>>>haven''t a clue on how to do that (client side javascript?) or render to >>>>>file. >>>>> >>>>>Anybody doing something like this that can push me in a direction? >>>>> >>>>>Craig >>>>> >>>>>_______________________________________________ >>>>>Rails mailing list >>>>>Rails@lists.rubyonrails.org >>>>>http://lists.rubyonrails.org/mailman/listinfo/rails >> >>_______________________________________________ >>Rails mailing list >>Rails@lists.rubyonrails.org >>http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
On Wed, 2006-03-01 at 00:51 -0800, Ben Munat 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. ;-) Craig