natros / gwt-cal

Automatically exported from code.google.com/p/gwt-cal
0 stars 2 forks source link

Make output print friendly. #39

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Description of the new feature:
If you test from the demos on the gwt-cal wiki and hit Ctrl-P or
"File>>Print...", you will see a lot of visual oddities on the printed
page, which can also be simulated through print to pdf.

Use Case:
Some users may want to print a readable calendar.  

Assumptions:
1. If compared to Google's calendar, black and white is offered for better
printability.
2. Styling with gradients
3. Event borders are not lost during print.

Exceptions:
1. ???

Code / psuedo-code:

Original issue reported on code.google.com by paresthe...@gmail.com on 23 Mar 2010 at 5:21

Attachments:

GoogleCodeExporter commented 8 years ago
Generating a print-friendly version of the DayView is not an easy task. This is 
evident by the fact that 1) you can't use File>Print on Google Calendar ... it 
looks 
just as bad as the screenshot you sent and 2) when you click the "print" link 
in 
Google Calendar it generates an Image using server-side code

We have no immediate plans to solve this problem, but will keep in mind for out 
later 
releases.

Thanks for the feedback

Original comment by Brad.Ryd...@gmail.com on 27 Mar 2010 at 10:15

GoogleCodeExporter commented 8 years ago
I must first say that this is a great project... thanks for all of the hard 
work with
this very useful component.

And, I think your point about the real google calendar print is valid, as they 
solve
the oddities by ultimately serving up an image.

But, I do have a couple small suggestions to make it more print friendly (both 
of
which could be done in a separate print.css file for print media?):
1. increase the border of the appointments to 2px.  The borders will not 
disappear if
you do this.
2. possibly convert the print view to black & white, or make that optional 
(similar
to google cal).

Thanks for acknowledging.

Original comment by paresthe...@gmail.com on 31 Mar 2010 at 3:14

GoogleCodeExporter commented 8 years ago
I had an idea on how we could implement this --

We could use html5's Canvas element to draw the calendar as a "print preview". 
GwtCanvas component is included in the gwt 
incubator: http://code.google.com/p/google-web-toolkit-incubator/

The cool thing about the Canvas element is, based on the spec, you convert it 
to a data URI (Basically it is a base64 
image). The data URI can be opened in its own url:
window.location = canvas.toDataURL("image/png");

Or the data URI can be set inside an image's "src" attribute:
<img src="data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
vr4MkhoXe0rZigAAAABJRU5ErkJggg==" />

We could then instruct the browser to print just the image. So in theory using 
the Canvas tag we could accomplish both 
print-preview and print without any server-side code! 

I think this would be the best approach for tackling this enhancement once we 
have time to get to it. Of course this 
wouldn't be supported in IE6/7/8, but considering it is using html standards 
and is not a 'core' piece of Calendar 
functionality i'm not concerned with backward compatibility.

Original comment by Brad.Ryd...@gmail.com on 13 May 2010 at 2:49

GoogleCodeExporter commented 8 years ago
That's definitely a possibility.  Not sure if I agree with the lack of 
compatibility
for older IE... I'll be honest with you, from a user perspective, the same 
people who
want print are business types.  And most business types have access to only one
browser on their work desktop: IE6+... personally I could care less about 
supporting
IE6.  I think supporting IE7&8 is wise though. IE8 is just catching on in the
business world.  So, an HTML5 standardized(?) IE9 that supports canvas will 
take a
few years to finally make it to a workstation.

GwtCanvas (or it could be GWT Graph or both, I'd have to check) is being used 
on a
current project I am involved with and prints canvas for most browsers, but 
spits out
VML for IE. VML can be the IE alternative as it works with IE6-8 (when IE8 is in
compatibility mode, which you can force with a meta tag).

Another project that does the same: gwt-canvas: 
http://code.google.com/p/gwt-canvas/
Not sure if that is related to the gwt-incubator project, maybe it is the same 
code,
I have no clue from comparing the 2 links.

Maybe you can extend or use this gwt-canvas project as part of the print puzzle.

Food for thought.

Original comment by paresthe...@gmail.com on 13 May 2010 at 3:13