search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Printing Event Background

Asked by steve65
15 years ago.
I'm testing the free version at the moment before taking the plunge.

I've edited the source a little to allow events to have different colored backgrounds on screen.
Most browsers default to not printing background colors or images, therefore when printing a calendar, the calendar hour lines show through the Event DIV which makes the whole thing look untidy and unclear.

Is there an easy way to fix this other than asking users to change their browser options?
Comment posted by Dan Letecky
15 years ago.
I've just tried print preview in FF2 and IE7. While Firefox output is not so bad, IE does exactly what you describe.

The problem is that DayPilot was not designed to be printable. I think it would be better to have a special DayPilot control that would be printer-friendly (otherwise it's like designing for at least three other "browsers" - IE6/7 and FF print previews).

The white background might be created using a white 1x1 pixel image stretched on an underlying div (... not so easy). That's what I would probably try first.
Comment posted by steve65
15 years ago.
Thanks for your reply, I've tried quite a few solutions without success but I think I've finally settled on the following

in the daypilotcalendar renderevent function
I added
output.AddStyleAttribute("border-left", "1px solid " + stringFromColor(EventBorderColor));
output.AddStyleAttribute("border-right", "1px solid " + stringFromColor(EventBorderColor));
output.AddStyleAttribute("border-top", "1px solid " + stringFromColor(EventBorderColor));
output.AddStyleAttribute("border-bottom", "1px solid " + stringFromColor(EventBorderColor));

I then removed
divFix.AddStyleAttribute("border-left", "1px solid " + stringFromColor(EventBorderColor));
divFix.AddStyleAttribute("border-right", "1px solid " + stringFromColor(EventBorderColor));

This gives each event a better defined border when printing in ie6/7 and firefox, so the hourlines showing through are not such an issue.

Let me know if you think that breaks anything else.
Comment posted by Dan Letecky
15 years ago.
This should work fine. You just need to keep margin-top set to 1px and height set to 2px less than full height. You can even remove

output.AddStyleAttribute("background-color", stringFromColor(EventBorderColor));

from the main DIV definition.
Answer posted by Dan Letecky
13 years ago.

Since DayPilot Pro 4.9, printing is supported for DayPilotCalendar through PNG/JPG/GIF export:

Comment posted by Anonymous
10 years ago.

ma che minchiiate

Comment posted by Anonymous
9 years ago.

How to get the colors in the Day Pilot calendar when exporting to image?
Now when using the Export() method , only the default colors are taken.. The css applied is ignored. how to fix it ?
I am using the DayPilot Pro for ASP.NET MVC 1.6.

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.