[Rails] multi-page printing moving on

Ben Munat bent at munat.com
Wed Mar 1 08:51:25 GMT 2006


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 at 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 at 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 at lists.rubyonrails.org
>>>>>http://lists.rubyonrails.org/mailman/listinfo/rails
>>
>>_______________________________________________
>>Rails mailing list
>>Rails at lists.rubyonrails.org
>>http://lists.rubyonrails.org/mailman/listinfo/rails
> 
> 
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails


More information about the Rails mailing list