Page 1 of 2
Adding a chart Image in PDF Format to an Infragistics Report
Posted: Mon Dec 01, 2008 4:09 pm
by 9092401
Hi
Would anyone by any chance know how I can use the Infragistics Report
and add a TChart Image into this report and save it as a pdf.
I know how to create a PDF file with Infragistics but I dont quite know how to give it a Steema.TeeChart.Export.PDFFormat
Thanks.
Posted: Mon Dec 01, 2008 4:20 pm
by narcis
Hi qcrnd,
I'm afraid you'll have to ask Infragistics support how to add a pdf file itno their reports. I imagine it should be very similar to adding an image.
Posted: Tue Dec 02, 2008 9:23 am
by 9092401
Hi Narcis
the thing is I am not sure what the PDFFormat is exactly. I tried copying a PDFFormat to clipboard and when I opened adobe acrobat the option of creating a PDF from clipboard image was disabled. If I used JPEGFormat then it is OK. There seemed to be giberrish in the clipboard when copying PDFFormat to clipboard.
How exactly can I use the Image that was copied to the clipboard
Thanks.
Posted: Tue Dec 02, 2008 9:47 am
by narcis
Hi qcrnd,
Are you copying PDF export to the clipboard like this?
Code: Select all
tChart1.Export.Image.PDF.CopyToClipboard();
Posted: Tue Dec 02, 2008 10:18 am
by 9092401
Hi
Yes . this is my code.
Steema.TeeChart.Export.PDFFormat pdfFormat = tChart1.Export.Image.PDF;
pdfFormat.CopyToClipboard();
Posted: Tue Dec 02, 2008 10:47 am
by 9092401
Hi Narcis
I think I will approach this a little differently after a little research.
I think I will use the Save into IO.Stream and then create a bitmap.
But now I have a different question.
HOW can I export a TChart Image but with a different size then the actual TChart itself
The only way I found is to actually modify the size of the tchart itself, call Update() and then call the export. But then the resize will be visible and it doesnt look nice.
I tried using SuspendLayout but that doesnt help either.
How can I solve this .
Thanks.
Posted: Tue Dec 02, 2008 11:15 am
by narcis
Hi qcrnd,
Yes, you can set specific image dimensions before exporting, for example:
Code: Select all
tChart1.Export.Image.Bitmap.Width = 800;
tChart1.Export.Image.Bitmap.Height = 600;
tChart1.Export.Image.Bitmap.Save(fileName);
Posted: Tue Dec 02, 2008 12:49 pm
by 9092401
Hi Narcis
Thanks , is this a proper redrew when changing the size just like the tchart is redrawn or is it a simple stretch bitmap , because stretch wont work nicely .
Regarding PDF , how exactly can I create an Windows Image using the PDF format. I tried pdfFormat.Save to IO.Stream but it caused an exception.
Thanks.
Posted: Tue Dec 02, 2008 1:20 pm
by narcis
Hi qcrnd,
Thanks , is this a proper redrew when changing the size just like the tchart is redrawn or is it a simple stretch bitmap , because stretch wont work nicely.
No, it is a bitmap redraw.
Regarding PDF , how exactly can I create an Windows Image using the PDF format. I tried pdfFormat.Save to IO.Stream but it caused an exception.
Code below works fine for me here using latest TeeChart for .NET v3 release.
Code: Select all
System.IO.MemoryStream stream = new System.IO.MemoryStream();
tChart1.Export.Image.PDF.Save(stream);
Posted: Tue Dec 02, 2008 1:55 pm
by 9092401
Hi Narcis
regarding Redraw , still dont understand , how exactly is the bitmap redrawn , is simply streched and if so what you are saying is that to get good results it is better to change the size of the actual chart itself or am I mistaken.
Regarding the PDF , sorry my mistake , I meant that after I create a stream what do I do with the stream , How can I create and image from this stream
for JPEG i do Bitmap bmp = new Bitmap(stream) , what Image can I use for a stream created from a PDFFormat.
Thanks.
Posted: Tue Dec 02, 2008 4:20 pm
by narcis
Hi qcrnd,
regarding Redraw , still dont understand , how exactly is the bitmap redrawn , is simply streched and if so what you are saying is that to get good results it is better to change the size of the actual chart itself or am I mistaken.
No, sorry if I haven't explained myself clearly. When saving a chart as a bitmap and setting a specific size for it, TeeChart internally renders a new bitmap without stretching/resizing current chart. For getting better quality exports you should just set dimensions you want and save the image as in the code snippet I posted.
Regarding the PDF , sorry my mistake , I meant that after I create a stream what do I do with the stream , How can I create and image from this stream
for JPEG i do Bitmap bmp = new Bitmap(stream) , what Image can I use for a stream created from a PDFFormat.
When you save a chart in PDF format to a stream or the clipboard they contain a PDF file. If you want to use it as an image you may use other image export formats. For vectorial exporting you could use SVG.
Hope this helps!
Posted: Wed Dec 03, 2008 8:06 am
by 9092401
Hi Narcis
So for the first question . Excellent thats good.
For the second question - In that case , any idea how I can integrate an SVG into a PDF . I created and SVG Chart file and but acrobat isnt able to create a PDF from this file.
I also tried creating an System.Drawing.Image from the SVGFormat stream and got an exception just like the PDFformat.
Thanks.
Posted: Wed Dec 03, 2008 11:37 am
by narcis
Hi qcrnd,
Can you save TeeChart generated SVG files to disk and open them using Internet Explorer?
Thanks in advance.
Posted: Wed Dec 03, 2008 1:01 pm
by 9092401
Hi Narcis
No I cannot , I tried to drag the file into IE and I get
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Parameter entity must be defined before it is used. Error processing resource '
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11...
Posted: Wed Dec 03, 2008 1:57 pm
by narcis
Hi qcrnd,
In that case you may need to install SVG viewer plugin:
http://www.adobe.com/svg/viewer/install/