public void Print(List<MPage> pages) { try { foreach (MPage page in pages) { //_pd.DefaultPageSettings.PaperSize = new PaperSize("Custom", 350, 50); _sessionPage = page; _sessionDoc.Print(); } } catch (Exception ex) { throw new Exception(String.Format("Ошибка принтера. {0}", ex.Message)); } }
public void Print() { _sessionDoc = new PrintDocument(); _sessionDoc.PrinterSettings.PrinterName = _printerName; _sessionDoc.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); _sessionDoc.PrintPage += new PrintPageEventHandler(this._printPage); try { foreach (MPage page in _pages) { //_pd.DefaultPageSettings.PaperSize = new PaperSize("Custom", 350, 50); _sessionPage = page; _sessionDoc.Print(); } } catch (Exception ex) { throw new Exception(String.Format("Ошибка принтера. {0}", ex.Message)); } }
public MText(MPage ownerPage, string text, Font font, RectangleF rectangle, int horAlign, int verAlign, float angle) { OwnerPage = ownerPage; Text = text; Font = font; HorAlign = horAlign; VerAlign = verAlign; Angle = angle; if (ownerPage != null) { this.X = rectangle.Left * ownerPage.Width / 100; this.Y = rectangle.Top * ownerPage.Height / 100; this.Width = rectangle.Width * ownerPage.Width / 100; this.Height = rectangle.Height * ownerPage.Height / 100; } else { throw new Exception("Страница не задана"); } Brush = Brushes.Black; }
public void NewPage(float width, float height, int fieldLeft, int fieldTop, int fieldRight, int filedBottom, float originY) { MPage page = new MPage(width, height, fieldLeft, fieldTop, fieldRight, filedBottom, originY); _pages.Add(page); _currentPage = page; }