My goal is to build a FlowDocument containing XamDataChart and some other contents.
//Create a bitmap rendering the Chart:
RenderTargetBitmap renderVisual = new RenderTargetBitmap( width, height, dpiX, dpiY, format );
renderVisual.Render( xamDataChart );
//Scale the bitmap to fit page:
ScaleTransform transform = new ScaleTransform( ratio1, ratio2 );
TransformedBitmap bitmapToUse = new TransformedBitmap( renderVisual, transform );
Thus prepared “bitmapToUse” is then being placed into a FlowDocument and printed. However the quality of such printout is low probably due to re-scaling of the picture.
Is there a better way to do this?
Thank you.
Hello,
I have been looking into your issue and it is regarding neither to our control nor the WPF platform. It occurs because the printer auto fit the image to the page size.
In order to achieve the desired functionality you can transform the XamDataChart to fit the size of the format that you would like to use and after that invoke the RenderTargetBitmap fit this size.
If you need any further assistance on this matter, feel free to ask.
Your response did not help.
I’m already using “RenderTargetBitmap” the way it’s described in Peter’s blog – please refer to the first two lines (excluding comment) of the code snippet I provided. My problem is with pre-print scaling (lines three and four) that lowers the quality of picture. And I’m not saving it to file so your advice to use .jpeg is meaningless.
In a nutshell, I have a chart of random dimensions on the screen, I need to resize it proportionally to fit printer's paper size. Any thoughts?
I am just checking if my last reply was helpful for you.
If you require any further assistance please do not hesitate to ask.
I can suggest using .jpeg format instead of .bmp because of the lossy compression method that it uses. I can suggest looking through the following blog where Peter has explained how to convert controls to images :
http://blogs.infragistics.com/blogs/petar_monov/archive/2012/03/14/controls-to-images.aspx
If you have any other questions, feel free to ask.