Fix plot printing support #301

Open
dnschnur opened this Issue Sep 28, 2012 · 10 comments

Comments

Projects
None yet
2 participants
Owner

dnschnur commented Sep 28, 2012

Original author: basse...@nesasrl.it (September 15, 2009 16:22:01)

I can not print charts with Opera 10.0
For example http://people.iola.dk/olau/flot/examples/turning-series.html
is printable and you can obtain a perfect preview in IE7 but not in Opera.
Is it a bug or there are some option to set up in Opera?

Original issue: http://code.google.com/p/flot/issues/detail?id=222

Owner

dnschnur commented Sep 28, 2012

From olau%iol...@gtempaccount.com on October 21, 2009 17:05:57
It might be a bug in Opera. It would be helpful if you could investigate it further.
Printing is still hit or miss I'm afraid.

Owner

dnschnur commented Sep 28, 2012

From hexm...@gmail.com on October 29, 2009 16:36:04
I'm seeing the same thing on Opera 10 vs Firefox 3.5 on Linux

Owner

dnschnur commented Sep 28, 2012

From HenrySev...@gmail.com on January 12, 2010 18:19:29
All the examples from [1] work with Opera 10.10 (self compiled), could you recheck
the issue?

[1] http://people.iola.dk/olau/flot/examples/

Owner

dnschnur commented Sep 28, 2012

From kylego...@gmail.com on February 11, 2010 18:11:12
I'm running Opera 10.10 on OS X and I cannot see a single example given in comment
[3].

Owner

dnschnur commented Sep 28, 2012

From dmcoo...@gmail.com on June 04, 2010 19:32:48
I've been looking into this problem, and think I've figured out the cause. I noticed
in my testing that when I printed to a PDF, then loaded that PDF I would see the plot
for a moment, then it was covered up by a white block. I suspected that this was
being caused by an extra page element that was covering up the plot. So I used
Chrome's element inspector to disect the page. Sure enough, the plot has two canvas
elements after the page-load. For whatever reason, when the chart is printed, this
second Canvas overlays the plot, and obscures you from printing anything useful.

I'm looking into how to suppress the second canvas so that printing works. Might be
possible with some creative style-sheet work.

I've attached an example of the PDF which shows the two canvas elements.

Owner

dnschnur commented Sep 28, 2012

From dmcoo...@gmail.com on March 11, 2011 19:22:24
I've found a work-around to this problem. Since Opera is unable to print canvas elements, the fix is to convert your canvas to an image before printing. Since its possible to convert a canvas element to an image (PNG, JPG, etc.) I added a printable version of my page which converts all canvas elements to images prior to printing. One thing that makes this a little tricker is that Flot renders portions of each chart (axis, legends, etc.) as HTML rather than drawing the entire thing on the canvas. I found a plugin which forces these elements to be rendered as part of the canvas.

The entire write-up for how to do this can be found here, along with some examples of the implemented solution.

http://lessaworld.com/projects/flotCanvasText/

Owner

dnschnur commented Sep 28, 2012

From olau%iol...@gtempaccount.com on March 11, 2011 20:47:00
You never got the CSS trick to work? I think it makes sense to add a CSS rule to hide the overlay if possible, but never got around to figuring out how.

Owner

dnschnur commented Sep 28, 2012

From sutt...@gmail.com on November 28, 2011 17:12:44
This problem affected me in IE8 (using excanvas.js in place of the regular canvas element). The chart was being obscured by a div or some other block over the chart.

The solution was in commenting out the following lines in excanvas.js:

//var overlayEl = el.cloneNode(false);
// Use a non transparent background.
//overlayEl.style.backgroundColor = 'red';
//overlayEl.style.filter = 'alpha(opacity=0)';
//canvasElement.appendChild(overlayEl);

Apparently this issue was affecting jqplot users as well, and that's what finally led me to that solution. More here:

https://bitbucket.org/cleonello/jqplot/issue/268/blank-chart-when-print-ie

Owner

dnschnur commented Sep 28, 2012

From dnsch...@gmail.com on May 07, 2012 23:26:09
I'm turning this into the master ticket for printing issues on all browsers, since they generally stem from the same set of problems.

From experience, this is not an easy task. No browser has proper support for printing; they're all significantly broken in one way or another.

alex-eri commented Aug 3, 2013

Firefox and Chromium print is ok, but not Opera 12x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment