Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
RenderPdfFriendlyGraphics peculiarities, workaround? documented anywhere?
posted

I'm inserting a UltraChart (GanttChart) to a pdf using RenderPdfFriendlyGraphics and Infragistics.Documents.Report (btw: so far,  I find the document engine works pretty well, nice!) and I've noticed a couple of places where rendering produces quite different results when using RenderPdfFriendlyGraphics. 

I guess it's to be expected that there are some differences to the normal rendering, but in some places I find the rendering a bit annoying. A particular problem is that Fontstyles seem to get lost. Font that I set to bold like:

[for a label]

LabelStyle labelStyle = textPrimitive.GetLabelStyle();
Font internalFont = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold);
labelStyle.Font = internalFont;

[for a textprimitive]

 textPrimitive.labelStyle.Font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);

are rendered as a normal font in the pdf. Therefore all the font decoration I added to the report in various places is now lost! This is bad. Is it possible to have bold fonts in a chart exported to PDF at all? Only for some fonts perhaps? FontStyle.Underline seems to work fine...

I also found that some textures/hatches are rendered differently:

eg:

PaintElement pe = ...

pe.Fill = Color.Silver;
pe.FillOpacity = 200;
pe.Texture = TexturePresets.Vertical;

here the Opacity is lost.

pe.ElementType = PaintElementType.Hatch;
pe.Hatch = FillHatchStyle.DashedHorizontal;

results in a different HatchStyle. I tried this with different Hatches and the results seem a little unpredictable. Would be great if the HatchStyle was different so that it can be a vector graphic, but unfortunately it's still a raster hatch, just a different one. 

Well, the different HatchStyles I can live with but I have overlapping elements and would really like to continue having opacity.

I believe I can still have opacity for non-textured PaintElements, so I *might* be able to reasonably around this. However, I'm wondering if there is possibly a trick or some textures for which opacity is supported and/or if it's documented anywhere what things work how when using RenderPdfFriendlyGraphics?

In general I think charts export quite well to pdf (having to use bitmaps would look much worse) for standard charts, but I do a bit of custom drawing and I guess not many people want to use textures with opacity (for overlapping elements)... :)

Thanks!