Jump to content
Software FX Community

Print Preview/Printing artifacts


jzdecourcy

Recommended Posts

I have a simple radial gauge with a custom background image that looks fine in the browser (IE 6+), but when viewed in print preview or actually printed the  labels for the main scale become "blotchy".  Is there some trick to configuring a gauge for optimum printability?

Link to comment
Share on other sites

  • 3 weeks later...

Unfortunately, there is no way to optimize the look for the gauge labels; however, as a workaround, you could export the gauge to a memory stream, and draw the image directly to the Print Object in the PrintPage() Event using GDI+. You could provide a button in your application for PrintPreview, for example, which will fire this PrintPage() event thus showing the gauge image with much better quality. Below, please find a code snippet on how to implement this solution:

public partial class _Default : System.Web.UI.Page

{

private MemoryStream ms;protected void Page_Load(object sender, EventArgs e)

{

ms = new MemoryStream();

RadialGauge1.MainValue = 75;

RadialGauge1.MainScale.Min = 0;

RadialGauge1.MainScale.MinAlwaysDisplayed = true;

RadialGauge1.MainScale.Max = 100;

RadialGauge1.MainScale.MaxAlwaysDisplayed =

true;RadialGauge1.Export(ImageFormat.Jpeg, ms);

ms.Position = 0;

PrintDocument pd = new PrintDocument();

pd.PrintPage +=

new PrintPageEventHandler(pd_PrintPage);System.Windows.Forms.PrintPreviewDialog ppd = new System.Windows.Forms.PrintPreviewDialog();

ppd.Document = pd;

ppd.ShowDialog();

}

void pd_PrintPage(object sender, PrintPageEventArgs e)

{

e.Graphics.DrawImage(System.Drawing.Image.FromStream(ms), new Point(25, 25));

}

}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...