PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Rendering MigraDoc with Chart to RTF
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1092
Page 1 of 1

Author:  don4ld [ Thu Mar 11, 2010 2:23 pm ]
Post subject:  Rendering MigraDoc with Chart to RTF

Hi there,

When i apply a RTF document renderer to the MigraDoc document on the sample "HelloMigraDoc", the resulting rtf document doesnt contains the chart.

I try to figure it out but i cannot understand. The MigraDoc.RtfRendering project has a ChartRenderer, that i already tested and it is called while rendering the document.

Is there a reasonable explanation for that? Like a bug? =P

Regards,
Joel

Author:  Thomas Hoevel [ Thu Mar 11, 2010 4:25 pm ]
Post subject:  Re: Rendering MigraDoc with Chart to RTF

Hi, Joel!
don4ld wrote:
Like a bug? =P

Could be a bug, could be an implementation limitation ...

MigraDoc includes the following code (in Chartrenderer.cs, Method "bool StoreTempImage(string fileName)"):
Code:
#if true
        XGraphics gfx = XGraphics.CreateMeasureContext(new XSize(horzPixels, vertPixels), XGraphicsUnit.Point, XPageDirection.Downwards);
#else
#if GDI
        XGraphics gfx = XGraphics.FromGraphics(Graphics.FromImage(bmp), new XSize(horzPixels, vertPixels));
#endif
#if WPF
        // TODOWPF
        XGraphics gfx = null; //XGraphics.FromGraphics(Graphics.FromImage(bmp), new XSize(horzPixels, vertPixels));
#endif
#endif


Maybe it'll work like this (GDI build only):
Code:
#if GDI
        XGraphics gfx = XGraphics.FromGraphics(Graphics.FromImage(bmp), new XSize(horzPixels, vertPixels));
#endif
#if WPF
        // TODOWPF
        XGraphics gfx = null; //XGraphics.FromGraphics(Graphics.FromImage(bmp), new XSize(horzPixels, vertPixels));
#endif


I won't be able to try it this week.

Author:  don4ld [ Thu Mar 11, 2010 5:30 pm ]
Post subject:  Re: Rendering MigraDoc with Chart to RTF

Thank you for the answer.

Well i have tried it by removing all the preprocessor directives and it works.
You said that it just works for GDI, so I need to ask: You are rendering a document object model to a specific file format, pdf or rtf, so why does wpf and gdi matter at this level of the code? Shouldnt it just matter for visual components, like document preview?

Another thing I would like to comment is if couldnt it be more elegant PdfSharp.Drawing (specifically Xgraphic and associated classes) being independent of PDF and and RTF, as you use it inside the RTF Renderer. I'm seeing it more like another renderer, but for images, that could be called by the RTF or PDF renderer to render and return a image.

Congratulations for this really cool stuff you've done ;)

Regards,
Joel

Author:  cliff [ Fri Sep 30, 2011 4:54 am ]
Post subject:  Re: Rendering MigraDoc with Chart to RTF

Hi there,

We have recently attempted to render charts to both PDF and RTF using the version 1.31 compiled assemblies. Currently we are able to render the chart correctly in PDF, however when rendering to RTF, the chart is rendered to the screen and not to the document. I was wondering if a fix will be available for the complied assemblies in the near future? We're using the GDI impliementation.

I have attempted to recompile the source code using Visual Studio Express 2010 C3 without success.

Kind regards,

Cliff

Author:  Thomas Hoevel [ Tue Oct 04, 2011 8:16 am ]
Post subject:  Re: Rendering MigraDoc with Chart to RTF

Hi!
cliff wrote:
I have attempted to recompile the source code using Visual Studio Express 2010 C3 without success.
How can we help you if you don't include error messages?

AFAIK you can recompile PDFsharp without VS, using the MSBUILD.EXE from the .NET directory.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/