Adding a chart Image in PDF Format to an Infragistics Report

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Adding a chart Image in PDF Format to an Infragistics Report

Post by qcrnd » Mon Dec 01, 2008 4:09 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Dec 01, 2008 4:20 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Tue Dec 02, 2008 9:23 am

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 02, 2008 9:47 am

Hi qcrnd,

Are you copying PDF export to the clipboard like this?

Code: Select all

			tChart1.Export.Image.PDF.CopyToClipboard();
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Tue Dec 02, 2008 10:18 am

Hi
Yes . this is my code.

Steema.TeeChart.Export.PDFFormat pdfFormat = tChart1.Export.Image.PDF;
pdfFormat.CopyToClipboard();

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Tue Dec 02, 2008 10:47 am

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 02, 2008 11:15 am

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);
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Tue Dec 02, 2008 12:49 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 02, 2008 1:20 pm

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);
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Tue Dec 02, 2008 1:55 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 02, 2008 4:20 pm

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Wed Dec 03, 2008 8:06 am

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 03, 2008 11:37 am

Hi qcrnd,

Can you save TeeChart generated SVG files to disk and open them using Internet Explorer?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Wed Dec 03, 2008 1:01 pm

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...

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 03, 2008 1:57 pm

Hi qcrnd,

In that case you may need to install SVG viewer plugin:

http://www.adobe.com/svg/viewer/install/
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply