using System; using System.Collections.Generic; using System.Linq; using System.Web; using Microsoft.Reporting.WebForms; using System.Globalization; namespace EmisTerminal { public class ReportPrintHelper { public static string CreateEMFDeviceInfo(Report report) { var pageSettings = report.GetDefaultPageSettings(); // The device info string defines the page range to print as well as the size of the page. // A start and end page of 0 means generate all pages. return string.Format( CultureInfo.InvariantCulture, "emf00{0}{1}{2}{3}{4}{5}", ToInches(pageSettings.Margins.Top + 20), ToInches(pageSettings.Margins.Left), ToInches(pageSettings.Margins.Right), ToInches(pageSettings.Margins.Bottom), ToInches(pageSettings.PaperSize.Height), ToInches(pageSettings.PaperSize.Width)); } private static string ToInches(int hundrethsOfInch) { double inches = hundrethsOfInch / 100.0; return inches.ToString(CultureInfo.InvariantCulture) + "in"; } } }