Example #1
0
        /// <summary>
        /// The actual method that makes API calls to drop the shadow to the window
        /// </summary>
        /// <param name="window">Window to which the shadow will be applied</param>
        /// <returns>True if the method succeeded, false if not</returns>
        private static bool DropShadow(Window window)
        {
            try
            {
                WindowInteropHelper helper = new WindowInteropHelper(window);
                int val = 2;
                int ret1 = DwmSetWindowAttribute(helper.Handle, 2, ref val, 4);  

                if (ret1 == 0)
                {
                    Margins m = new Margins { Bottom = 0, Left = 0, Right = 0, Top = 0 };
                    int ret2 = DwmExtendFrameIntoClientArea(helper.Handle, ref m);
                    return ret2 == 0;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception)
            {
                // Probably dwmapi.dll not found (incompatible OS)
                return false;
            }
        }
Example #2
0
        private void GetPrinters_Click(object sender, EventArgs e)
        {
            //PrintDocument pd = new PrintDocument();
            //pd.DefaultPageSettings.Bounds = new
            //pd.Print();

            PrintPreviewDialog ppd = new PrintPreviewDialog();
            PrintDocument pd = new PrintDocument();
            //设置边距
            Margins margin = new Margins(200, 20, 20, 0);
            pd.DefaultPageSettings.Margins = margin;
            //纸张设置默认
            PaperSize pageSize = new PaperSize("First custom size", getYc(58), 100);
            pd.DefaultPageSettings.PaperSize = pageSize;
            //打印事件设置
            pd.PrintPage += pd_PrintPage;
            ppd.Document = pd;
            ppd.ShowDialog();
            //try
            //{
            //    pd.Print();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "打印出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    pd.PrintController.OnEndPrint(pd, new PrintEventArgs());
            //}
        }
Example #3
0
 public void Print()
 {
     //打印
     if (string.IsNullOrEmpty(_print_doc.PrinterSettings.PrinterName))
     {
         _print_doc.PrinterSettings.PrinterName = new System.Drawing.Printing.PrintDocument().PrinterSettings.PrinterName;
     }
     //_print_doc.PrinterSettings.PrinterName = "Zebra 105SL"; // "Microsoft XPS Document Writer"; //
     System.Drawing.Printing.Margins margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
     _print_doc.DefaultPageSettings.Margins = margins;
     // 设置纸张
     PaperSize paperSize = new PaperSize();
     switch (_lable.Type)
     {
         case LableType.BIG:
         case LableType.BIG1:
         case LableType.PIPE:
         case LableType.PIPE2:
             paperSize.Height = 394;
             paperSize.Width = 285;
             paperSize.PaperName = "大标牌";
             _print_doc.DefaultPageSettings.PaperSize = paperSize;
             break;
         case LableType.LITTLE:
              paperSize.Height = 217;
              paperSize.Width = 264;
              paperSize.PaperName = "小标牌";
              _print_doc.DefaultPageSettings.PaperSize = paperSize;
             break;
         default:
             break;
     }
     _print_doc.DefaultPageSettings.PrinterSettings.Copies = (short)_copies;
     _print_doc.Print();
 }
Example #4
0
        public Chart(ChartPanel chartPanel, string name)
        {
            _chartPanel = chartPanel;
              _title = name;

              _axisList = new List<Axis>();
              _axisList.Add(new Axis(this, "Theta", "Degrees"));
              _axisList.Add(new Axis(this, "R", "%"));

              _margins = new Margins(52, 24, 24, 44);

              _pnFrame = new Pen(Color.Silver, 1.0f);
              _pnGridMain = new Pen(Color.Gray, 1.0f);
              _pnGridAux = new Pen(Color.Gray, 1.0f);
              _pnGridAux.DashStyle = DashStyle.Dash;
              _pnSelection = new Pen(Color.FromKnownColor(KnownColor.HotTrack), 1.0f);
              _pnProgress = new Pen(Color.SpringGreen, 2.0f);

              _brSelection = new SolidBrush(Color.FromArgb(32, Color.FromKnownColor(KnownColor.HotTrack)));

              _fntTickMarks = new Font("Arial", 8.0f);
              _fntLabelsH = new Font("Arial", 8.0f, FontStyle.Bold);
              _fntLabelsV = new Font("Arial", 8.0f, FontStyle.Bold/*, GraphicsUnit.Pixel, Encoding. 0, true*/);

              _seriesList = new List<Series>();

              CreateGradientBrushes();
        }
        private static bool DropShadow(Window window)
        {
            try
            {
                var helper = new WindowInteropHelper(window);
                var attrValue = 2;
                var attribute = DwmSetWindowAttribute(helper.Handle, 2, ref attrValue, 4);

                if (attribute != 0)
                {
                    return false;
                }

                var margins = new Margins
                {
                    Bottom = 0,
                    Left = 0,
                    Right = 0,
                    Top = 0
                };

                return DwmExtendFrameIntoClientArea(helper.Handle, ref margins) == 0;
            }
            catch
            {
                return false;
            }
        }
Example #6
0
 public MARGINS(Margins margins)
 {
     cxLeftWidth = margins.Left;
     cxRightWidth = margins.Right;
     cyTopHeight = margins.Top;
     cyBottomHeight = margins.Bottom;
 }
 /// <summary>
 /// 数据打印
 /// </summary>
 /// <param name="printData"></param>
 public virtual void InvoicePrint(PrintDataClass printData)
 {
     PrintDocument document = new PrintDocument();
     //this.PrintData = printData;
     Margins margins = new Margins(this.DanToPex(0.5M), this.DanToPex(0.5M), this.DanToPex(0.5M),
         this.DanToPex(0.5M));
     document.DefaultPageSettings.Margins = margins;
     PaperSize size = new PaperSize("First custom size", this.DanToPex(PageSizeW), this.DanToPex(PageSizeH));
     document.DefaultPageSettings.PaperSize = size;
     document.PrintController = new StandardPrintController();
     document.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
     try
     {
         document.Print();
         LogHelper.WriteLog("过磅编号为:" + GetTextDate() + "。数据打印成功!");
     }
     catch (Exception e)
     {
         document.PrintController.OnEndPrint(document, new PrintEventArgs());
         LogHelper.WriteLog(LogHelper.GetCurSourceFileName() + "~" + LogHelper.GetLineNum() + "打印失败!", e);
     }
     finally
     {
         this.printData = null;
     }
 }
 public PageDef(Margins m, int count)
 {
     colstoprint = new List<object>(count);
     colwidths = new List<float>(count);
     colwidthsoverride = new List<float>(count);
     coltotalwidth = 0;
     margins = (Margins)m.Clone();
 }
Example #9
0
        public Report()
        {
            Width = 595F;
            Height = 842F;
            Margins = new Margins(0, 0, 50, 50);

            Header = new ReportSection(this);
            Body = new ReportSection(this);
            Footer = new ReportSection(this);
        }
 protected FixedDocument GenerateReport(Func<int, object> frameDataContext, Size paperSize, Margins margins, IEnumerable records)
 {
     var document = new FixedDocument();
       document.DocumentPaginator.PageSize = new Size(DPI * paperSize.Width, DPI * paperSize.Height);
       foreach (var page in CreatePages(frameDataContext, paperSize, margins, records))
       {
     document.Pages.Add(page);
       }
       return document;
 }
Example #11
0
 public ClientQuery()
 {
     _column = new QueryColumnsCollection(this, typeof(QueryColumns));
     _caption = "";
     _margin = new Margins(100, 30, 30, 30);
     _gaphorizontal = 80;
     _gapvertical = 20;
     _keepcondition = false;
     _font = new Font("SimSun", 9.0f);
     _forecolor = SystemColors.ControlText;
     _textcolor = SystemColors.ControlText;
 }
Example #12
0
 public frmPrint()
 {
     InitializeComponent();
     lines = new string[50];
     printDialog.Document = docToPrint;
     docToPrint.BeginPrint += new PrintEventHandler(OnBeginPrint);
     docToPrint.PrintPage += new PrintPageEventHandler(OnPrintPage);
     pageSetupDialog.Document = docToPrint;
     previewDialog.Document = docToPrint;
     Margins mar = new Margins(50, 50, 50, 50);
     docToPrint.DefaultPageSettings.Margins = mar;
 }
	public PageSettings(PrinterSettings printerSettings)
			{
				if(printerSettings != null)
				{
					this.printerSettings = printerSettings;
				}
				else
				{
					this.printerSettings = new PrinterSettings();
				}
				margins = new Margins();
			}
 internal PrintPreviewLayout(IServiceProvider serviceProvider, WorkflowPrintDocument printDoc) : base(serviceProvider)
 {
     this.pageLayoutInfo = new ArrayList();
     this.headerFooterMargins = new Margins(0, 0, 0, 0);
     this.pageSeparator = DefaultPageSeparator;
     this.pageMargins = DefaultPageMargins;
     this.rowColumns = new Size(1, 1);
     this.scaling = 1f;
     this.pageSize = Size.Empty;
     this.previewTime = DateTime.Now;
     this.printDocument = printDoc;
 }
Example #15
0
		public void CtorDefault ()
		{
			Margins m = new Margins ();
			Assert.AreEqual (100, m.Left, "Left");
			Assert.AreEqual (100, m.Top, "Top");
			Assert.AreEqual (100, m.Right, "Right");
			Assert.AreEqual (100, m.Bottom, "Bottom");
			Assert.AreEqual ("[Margins Left=100 Right=100 Top=100 Bottom=100]", m.ToString (), "ToString");
			Margins clone = (Margins) m.Clone ();
			Assert.AreEqual (m, clone, "clone");
			Assert.IsTrue (m == clone, "==");
			Assert.IsFalse (m != clone, "!=");
		}
        public EkipeFinaleKupaIzvestaj(IList<RezultatEkipnoFinaleKupa> rezultati, Gimnastika gim,
            bool kvalColumn, DataGridView formGrid, string documentName)
        {
            DocumentName = documentName;

            Font itemFont = new Font("Arial", 8);
            Font itemsHeaderFont = new Font("Arial", 8, FontStyle.Bold);

            Landscape = false;
            Margins = new Margins(75, 75, 75, 75);

            lista = new EkipeFinaleKupaLista(this, 1, 0f, itemFont, itemsHeaderFont, rezultati,
                gim, kvalColumn, formGrid);
        }
        protected MapPrintPreviewForm()
        {
            InitializeComponent();

            MapPaperMergins = new Margins(100, 100, 100, 100);
            ScrollingMergins = new Margins(80, 80, 80, 80);
            dlgPageSetup.PageSettings.Landscape = true;
            PageSize = PaperSizes.A4;
            docPrint.PrintPage += docPrint_PrintPage;
            dlgPageSetup.PageSettings.Margins = new Margins(30, 35, 30, 30);
            ShowMarkerInfo = true;

            InitializePageSizes();
        }
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="paginator"></param>
        /// <param name="pageSettings"></param>
        /// <param name="printTicket"></param>
        /// <param name="headerFooterfontFamily"></param>
        public DocumentPaginatorWrapper(DocumentPaginator paginator, PageSettings pageSettings, PrintTicket printTicket, FontFamily headerFooterfontFamily)
        {
            m_Margins = ConvertMarginsToPx(pageSettings.Margins);

              if (pageSettings.Landscape)
            m_PageSize = new Size((int)printTicket.PageMediaSize.Height, (int)printTicket.PageMediaSize.Width);
              else
            m_PageSize = new Size((int)printTicket.PageMediaSize.Width, (int)printTicket.PageMediaSize.Height);

              m_Paginator = paginator;
              m_Paginator.PageSize = new Size(m_PageSize.Width - m_Margins.Left - m_Margins.Right, m_PageSize.Height - m_Margins.Top - m_Margins.Bottom);

              m_Typeface = new Typeface(headerFooterfontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
        }
Example #19
0
		public void Ctor4Int ()
		{
			Margins m1 = new Margins (Int32.MaxValue, Int32.MaxValue, Int32.MaxValue, Int32.MaxValue);
			Assert.AreEqual (Int32.MaxValue, m1.Left, "Left");
			Assert.AreEqual (Int32.MaxValue, m1.Top, "Top");
			Assert.AreEqual (Int32.MaxValue, m1.Right, "Right");
			Assert.AreEqual (Int32.MaxValue, m1.Bottom, "Bottom");
			// right smaller than left
			Margins m2 = new Margins (Int32.MaxValue, 0, 10, 20);
			// bottom smaller than top
			Margins m3 = new Margins (10, 20, Int32.MaxValue, 0);
			Assert.IsFalse (m2.GetHashCode () == m3.GetHashCode (), "GetHashCode");
			Assert.IsTrue (m1 != m2, "m1 != m2");
			Assert.IsFalse (m1 == m2, "m1 == m2");
		}
Example #20
0
        public UkupnoIzvestaj(IList<RezultatUkupnoExtended> rezultati, Gimnastika gim,
            bool extended, bool kvalColumn, DataGridView formGrid, string documentName)
        {
            DocumentName = documentName;

            Font itemFont = new Font("Arial", 8);
            Font itemsHeaderFont = new Font("Arial", 8, FontStyle.Bold);

            Landscape = extended;
            if (extended)
                Margins = new Margins(40, 40, 50, 50);
            else
                Margins = new Margins(75, 75, 75, 75);

            lista = new UkupnoLista(this, 1, 0f, itemFont, itemsHeaderFont, rezultati,
                gim, extended, kvalColumn, formGrid);
        }
Example #21
0
        public ListPrinter(PrintPageSettings ps, PrintPreviewControl pc = null)
        {
            pageSettings = ps;
            printFont = ps.Font;
            headerFont = ps.HeaderFont;
            nameBoxWidth = ps.NameBoxWidth;
            Margins margins = new Margins
            {
                Left = ps.LeftMargin,
                Right = ps.RightMargin,
                Top = ps.TopMargin,
                Bottom = ps.BottomMargin
            };

            doc.DefaultPageSettings.Margins = margins;
            doc.PrintPage += new PrintPageEventHandler(doc_PrintPage);

            previewControl = pc;
        }
 private Margins GetAdjustedMargins(Graphics graphics)
 {
     Margins margins = this.printDocument.PageSetupData.Margins;
     if (this.printDocument.PageSetupData.Landscape)
     {
         int left = margins.Left;
         margins.Left = margins.Right;
         margins.Right = left;
         left = margins.Bottom;
         margins.Bottom = margins.Top;
         margins.Top = left;
     }
     Margins hardMargins = new Margins();
     using (Graphics graphics2 = this.printDocument.PrinterSettings.CreateMeasurementGraphics())
     {
         hardMargins = this.printDocument.GetHardMargins(graphics2);
     }
     return new Margins(Math.Max(margins.Left, hardMargins.Left), Math.Max(margins.Right, hardMargins.Right), Math.Max(margins.Top, hardMargins.Top), Math.Max(margins.Bottom, hardMargins.Bottom));
 }
Example #23
0
        public void Print(List<PrintLine> lines, bool hasQRCode = true)
        {
            this.HasQRCode = hasQRCode;
            if (!this.HasQRCode)
                this.PageHeight = 350;
            this.Lines = lines;

            PrintDocument pd = new PrintDocument();
            pd.PrintPage += pd_PrintPage;
            //设置边距

            Margins margin = new Margins(20, 20, 20, 20);

            pd.DefaultPageSettings.Margins = margin;
            //纸张设置默认
            PaperSize pageSize = new PaperSize("自定义纸张", 228, (int)MessureHeight(lines) + 150);
            pd.DefaultPageSettings.PaperSize = pageSize;

            pd.Print();
        }
Example #24
0
		public PrintOptions(FlowChart document)
		{
			documentName = " - Untitled - ";
			headerFormat = "%D , Page %P";
			scale = 100.0f;
			enableShadows = true;
			enableImages = true;
			enableInterior = true;
			enableAnchors = false;
			enableBackground = true;
			enableBackgroundImage = true;
			enableText = true;
			paintControls = false;

			this.document = document;

			pageWidth = pageHeight = 0;

			// init the margins to the PrintDocument defaults of 1 inch
			margins = new Margins(100, 100, 100, 100);
		}
        private static IEnumerable<PageContent> CreatePages(Func<int, object> frameDataContext, Size paperSize, Margins margins, IEnumerable records)
        {
            var pageNumber = 1;
              var currentPage = CreatePage(frameDataContext(pageNumber), paperSize, margins);

              foreach (var record in records)
              {
            var control = record as FrameworkElement;

            var added = currentPage.TryAdd(control);
            if (!added)
            {
              yield return currentPage.Build();

              pageNumber++;
              currentPage = CreatePage(frameDataContext(pageNumber), paperSize, margins);
              currentPage.TryAdd(control);
            }
              }

              yield return currentPage.Build();
        }
        public void Print()
        {
            PrintDocument pd = new PrintDocument();
            pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
            Margins margins = new Margins(5, 5, 25, 25);
            pd.DefaultPageSettings.Margins = margins;

            for (int i = 0; i < listView.Columns.Count; i++)
            {
                columns.Add(i, 0);
            }

            // find the max length of each column
            foreach (ListViewItem lvi in listView.Items)
            {
                for (int x = 0; x < lvi.SubItems.Count; x++)
                {
                    if (lvi.SubItems[x].Text.Length > columns[x])
                    {
                        columns[x] = lvi.SubItems[x].Text.Trim().Length;
                    }
                }
            }

            // now scale the font to see if it will fit. smallest is 6pt.
            int lineWidth = 0;
            for (int i = 0; i < columns.Count; i++)
            {
                lineWidth = lineWidth + columns[i] + 1;
            } // total line character count

            if (lineWidth > 118)
            {
                pd.DefaultPageSettings.Landscape = true;
            }

            pd.Print();
        }
Example #27
0
 void Form1_Load(object sender, EventArgs e)
 {
     PrinterSettings setting = new PrinterSettings();
     PageSettings pageSetting = new PageSettings();
     Margins margin = new Margins(200, 200, 200, 200);
     
     setting.DefaultPageSettings.PrinterResolution.Kind = PrinterResolutionKind.High;
     
     pageSetting.PaperSize = new PaperSize("mypaper", 1200, 800);
     setting.DefaultPageSettings.PaperSize = new PaperSize("mypaper", 1200, 800);
     setting.PrintToFile = true;
     setting.PrintFileName = @"d:\documents and settings\axkhan2\desktop\myfile.tiff";
    
     printDocument1.DefaultPageSettings.PrinterSettings = setting;
     printDocument1.DefaultPageSettings = pageSetting;
     printDocument1.DefaultPageSettings.Margins = margin;
     
     printPreviewDialog1.Document = printDocument1;
   
     printPreviewDialog1.ShowDialog();
     //ShowPrintableArea();
     this.Close();
 }
Example #28
0
        public void Print()
        {
            //设置打印机名称
            if(string.IsNullOrEmpty(PrinterName))
            {
                PrinterName = new PrintDocument().PrinterSettings.PrinterName;
            }
            System.Drawing.Printing.Margins margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            _print_doc.DefaultPageSettings.Margins = margins;

            // 设置纸张
            PaperSize paperSize = new PaperSize();
            switch (_lable.Type)
            {
                case LableType.BIG:
                case LableType.BIG1:
                case LableType.BIG2:
                    paperSize.Height = 394; // 70*100
                    paperSize.Width = 285;
                    paperSize.PaperName = "大标牌";
                    _print_doc.DefaultPageSettings.PaperSize = paperSize;
                    break;
                case LableType.LITTLE:
                case LableType.LITTLE2:
                     paperSize.Height = 217;
                     paperSize.Width = 264;
                     paperSize.PaperName = "小标牌";
                     _print_doc.DefaultPageSettings.PaperSize = paperSize;
                    break;
                default:
                    break;
            }

            _print_doc.DefaultPageSettings.PrinterSettings.Copies = (short)_copies;
            _print_doc.Print();
        }
        internal PageSetupData()
        {
            RegistryKey key = Registry.CurrentUser.OpenSubKey(WinOEPrintingSubKey);
            if (null != key)
            {
                try
                {
                    object registryValue = null;

                    registryValue = key.GetValue(RegistryHeaderAlignment);
                    if (null != registryValue && registryValue is int) this.headerAlignment = (HorizontalAlignment)registryValue;

                    registryValue = key.GetValue(RegistryFooterAlignment);
                    if (null != registryValue && registryValue is int) this.footerAlignment = (HorizontalAlignment)registryValue;

                    registryValue = key.GetValue(RegistryHeaderMarging);
                    if (null != registryValue && registryValue is int) this.headerMargin = (int)registryValue;

                    registryValue = key.GetValue(RegistryFooterMarging);
                    if (null != registryValue && registryValue is int) this.footerMargin = (int)registryValue;

                    registryValue = key.GetValue(RegistryHeaderTemplate);
                    if (null != registryValue && registryValue is string) this.headerTemplate = (string)registryValue;

                    registryValue = key.GetValue(RegistryFooterTemplate);
                    if (null != registryValue && registryValue is string) this.footerTemplate = (string)registryValue;

                    registryValue = key.GetValue(RegistryHeaderCustom);
                    if (null != registryValue && registryValue is int) this.headerCustom = Convert.ToBoolean((int)registryValue);

                    registryValue = key.GetValue(RegistryFooterCustom);
                    if (null != registryValue && registryValue is int) this.footerCustom = Convert.ToBoolean((int)registryValue);

                    registryValue = key.GetValue(RegistryCenterHorizontally);
                    if (null != registryValue && registryValue is int) this.centerHorizontally = Convert.ToBoolean((int)registryValue);

                    registryValue = key.GetValue(RegistryCenterVertically);
                    if (null != registryValue && registryValue is int) this.centerVertically = Convert.ToBoolean((int)registryValue);
                }
                finally
                {
                    key.Close();
                }
            }

            PrinterSettings printerSettings = new PrinterSettings();
            this.landscape = printerSettings.DefaultPageSettings.Landscape;
            this.margins = printerSettings.DefaultPageSettings.Margins;
        }
        private void PrepareToPrint(PrintPageEventArgs printPageArg)
        {
            Graphics graphics = printPageArg.Graphics;

            Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize;
            ((IWorkflowDesignerMessageSink)this.workflowView.RootDesigner).OnLayoutSize(graphics);
            ((IWorkflowDesignerMessageSink)this.workflowView.RootDesigner).OnLayoutPosition(graphics);
            this.workflowView.RootDesigner.Location = Point.Empty;

            //STEP2: Get the units needed for calculation
            Size rootDesignerSize = this.workflowView.RootDesigner.Size;
            rootDesignerSize.Width += 3 * selectionSize.Width;
            rootDesignerSize.Height += 3 * selectionSize.Height;

            Size paperSize = printPageArg.PageBounds.Size;
            Margins hardMargins = GetHardMargins(graphics);
            Margins margins = new Margins(Math.Max(printPageArg.PageSettings.Margins.Left, hardMargins.Left),
                                          Math.Max(printPageArg.PageSettings.Margins.Right, hardMargins.Right),
                                          Math.Max(printPageArg.PageSettings.Margins.Top, hardMargins.Top),
                                          Math.Max(printPageArg.PageSettings.Margins.Bottom, hardMargins.Bottom));
            Size printableArea = new Size(paperSize.Width - (margins.Left + margins.Right), paperSize.Height - (margins.Top + margins.Bottom));
            printableArea.Width = Math.Max(printableArea.Width, 1);
            printableArea.Height = Math.Max(printableArea.Height, 1);

            //STEP3: Calculate the scaling
            if (this.pageSetupData.AdjustToScaleFactor)
            {
                this.scaling = ((float)this.pageSetupData.ScaleFactor) / 100.0f;
            }
            else
            {
                float xScaling = (float)this.pageSetupData.PagesWide * (float)printableArea.Width / (float)rootDesignerSize.Width;
                float YScaling = (float)this.pageSetupData.PagesTall * (float)printableArea.Height / (float)rootDesignerSize.Height;

                this.scaling = Math.Min(xScaling, YScaling);
                //leave just 3 digital points (also, that will remove potential problems with ceiling e.g. when the number of pages would be 3.00000000001 we'll get 4)
                this.scaling = (float)(Math.Floor((double)this.scaling * 1000.0d) / 1000.0d);
            }

            //STEP4: Calculate the number of pages
            this.totalPrintablePages.X = Convert.ToInt32(Math.Ceiling((this.scaling * (float)rootDesignerSize.Width) / (float)printableArea.Width));
            this.totalPrintablePages.X = Math.Max(this.totalPrintablePages.X, 1);
            this.totalPrintablePages.Y = Convert.ToInt32(Math.Ceiling((this.scaling * (float)rootDesignerSize.Height) / (float)printableArea.Height));
            this.totalPrintablePages.Y = Math.Max(this.totalPrintablePages.Y, 1);

            //STEP5: Calculate the workflow alignment
            this.workflowAlignment = Point.Empty;

            if (this.pageSetupData.CenterHorizontally)
                this.workflowAlignment.X = (int)(((float)this.totalPrintablePages.X * (float)printableArea.Width / this.scaling - (float)rootDesignerSize.Width) / 2.0f * this.scaling);

            if (this.pageSetupData.CenterVertically)
                this.workflowAlignment.Y = (int)(((float)this.totalPrintablePages.Y * (float)printableArea.Height / this.scaling - (float)rootDesignerSize.Height) / 2.0f * this.scaling);

            this.workflowAlignment.X = Math.Max(this.workflowAlignment.X, selectionSize.Width + selectionSize.Width / 2);
            this.workflowAlignment.Y = Math.Max(this.workflowAlignment.Y, selectionSize.Height + selectionSize.Height / 2);

            //STEP6: Store other variables used
            this.printTime = DateTime.Now;
        }