or
public void RenderPdfReport(IReportDocument report, string documentPath){ ReportProcessor reportProcessor = new ReportProcessor(); Hashtable deviceInfo = new Hashtable(); deviceInfo["FontEmbedding"] = "None"; RenderingResult result = reportProcessor.RenderReport("PDF", report, deviceInfo); if (result.DocumentBytes == null) return; using (FileStream fs = new FileStream(documentPath, FileMode.Create)) { fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); }}using System;using System.Drawing;using System.Linq;using Telerik.Reporting.Processing;namespace ReportSample{ public class ReportFont { public static void AutoSizeText(DetailSection dtl, int minFontSize, int maxFontSize) { foreach (Telerik.Reporting.Processing.ProcessingElement item in dtl.ChildElements) { if (!(item is ReportItem)) break; ReportItem rptItem = (ReportItem)item; if (TextSizingSupported(rptItem)) { AutoSizeText(rptItem, minFontSize, maxFontSize); } } } public static void AutoSizeText(ReportItem item, int minFontSize, int maxFontSize) { AutoSizeText(item, minFontSize, maxFontSize, false); } public static void AutoSizeText(ReportItem item, int minFontSize, int maxFontSize, bool forceResize) { if (!forceResize && !item.Name.EndsWith("_rf")) return; item.Style.Font.Size = GetFontSize(item, minFontSize, maxFontSize); } protected static Font GetFont(Telerik.Reporting.Drawing.Font font) { return GetFont(font.Name, font.Size.Value, font.Style); } protected static Font GetFont(Telerik.Reporting.Drawing.Font font, float fontSize) { return GetFont(font.Name, fontSize, font.Style); } protected static Font GetFont(string fontName, float fontSize, FontStyle style) { FontFamily fontFamily = new FontFamily(fontName); return GetFont(fontFamily, fontSize, style); } protected static Font GetFont(FontFamily fontFamily, float fontSize, FontStyle style) { return new Font(fontFamily, fontSize, style); } protected static bool TextSizingSupported(ReportItem item) { if (item is HtmlTextBox || item is TextBox) return true; return false; } protected static Telerik.Reporting.Drawing.Unit GetFontSize(ReportItem item, int minFontSize, int maxFontSize) { Size textSize; Font newFont = GetFont(item.Style.Font, maxFontSize); Size bounds = GetBounds(item); string value = GetValue(item); do { textSize = System.Windows.Forms.TextRenderer.MeasureText(value, newFont, bounds, System.Windows.Forms.TextFormatFlags.WordBreak); if (textSize.Height > bounds.Height && newFont.Size != minFontSize) newFont = GetFont(item.Style.Font, newFont.Size - 1); } while (textSize.Height > bounds.Height && newFont.Size > minFontSize); return Telerik.Reporting.Drawing.Unit.Point(newFont.Size); } protected static Size GetBounds(ReportItem tb) { Size bounds = (Size)tb.Bounds.Size; // Adjust the bounds slightly bounds.Height -= 3; return bounds; } protected static string GetValue(ReportItem item) { if (item is HtmlTextBox) return ((HtmlTextBox)item).Value.ToString(); if (item is TextBox) return ((TextBox)item).Value.ToString(); throw new Exception("Unsupported ReportItem passed."); } }}<p style="margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px;"><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #E57572;">%%CALLDATE%% - %%CALLTIME%%12345123451234512345</span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"><br /></span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"> this is a testdsafsdf</span></p><p style="margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px;"><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;">sent on </span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: bold;font-size: 12px;color: #000000;">%%LETTERDATE%%</span></p><p style="margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px;"><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: bold;font-size: 12px;color: #000000;"> </span></p><p style="margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px;"><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #E57572;">12345123451234512345</span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"><br /></span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #E57572;">12345123451234512345</span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"><br /></span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #E57572;">12345123451234512345123451234512345123451234512345123451234512345123451234512345</span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: normal;font-size: 12px;color: #000000;"><br /><br /><br /></span><span style="font-family: 'Segoe UI';font-style: Normal;font-weight: bold;font-size: 12px;color: #000000;" /></p>