Jump to content
Software FX Community

Printing chart shows up additional garbage


Oops
 Share

Recommended Posts

Hi

Im rendering my chart as an image and when i try to print it out using javascript im getting lots of additional garbage coming into the html that im supposed to get from the element.It looks like elements of the toolbar (i get the Load my chart icon and label, save my chart icon and label, restore defaults icon and label and the icons for all the galleries, and then som e colour palettes) Because my toolbar is disabled i cant understand why this is happening.

My javascript looks like so:

var prtContent1 = document.getElementById(Chart1);

var WinPrint = window.open('','','left=0,top=0,width=0,height=0,toolbar=0,scrollbars=0,status=0,resizable=0,menubar=0,');

WinPrint.document.write(prtContent1.innerHTML);

WinPrint.document.close();

WinPrint.focus();

WinPrint.print();

WinPrint.close();

Any ideas ?

Thanks

Link to comment
Share on other sites

I don't understand this code. What are you trying to do?

What is Chart1, shouldn't it be 'Chart1'? But it it is, prtContent1.innerHTML, will be nothing if the chart is an Image tag.

It seems that what you are getting is the page without the stylesheets.

If what you are trying to do is print the chart, the follwoing script will do it:

function SFX_PrintImage (imgId)

{

var chartImage = document.getElementById('Chart1');var imgSrc = chartImage.src;

 

var w = window.open ('', '_blank',

'menubar=0,location=0,status=0,resizable=0,scrollbars=0,titlebar=0,status=0,toolbar=0,linkbar=0,width=1,height=1');var html = '<HEAD><TITLE>Chart</TITLE></HEAD><HTML><BODY ONLOAD="if (window.print) { setTimeout(\'window.close()\', 1); window.print(); }">';

html +=

'<IMG SRC="' + imgSrc + '">';html += '<\/BODY><\/HTML>';

w.document.open();

w.document.write(html);

w.document.close();

}

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...