public static void DrawReportFooter(PagingSetup pagingSetup, PdfDocument document, string LabID) { for (int i = 0; i < document.Pages.Count; i++) { PdfPage page = document.Pages[i]; double lineWidth = page.Width - pagingSetup.MarginLeft - pagingSetup.MarginRight; double bottomLine = page.Height - pagingSetup.MarginTop; using (XGraphics gfx = XGraphics.FromPdfPage(page)) { var regularPen = new XPen(XColor.FromArgb(255, 0, 0, 0)); gfx.DrawLine(regularPen, pagingSetup.MarginLeft, bottomLine - 5, pagingSetup.MarginLeft + lineWidth, bottomLine - 5); } DrawParagraphOffset(pagingSetup, page, PagingSetup.CreateDefaultPDFSmallRegularFont(), XParagraphAlignment.Right, page.Height - pagingSetup.MarginTop, pagingSetup.SmallLineHeight, string.Format("Trang {0}/{1}", i + 1, document.Pages.Count)); string labName = HeaderService.GetHeader(LabID).Lab == null ? "" : HeaderService.GetHeader(LabID).Lab.Trim(); if (labName != "") { DrawParagraphOffset(pagingSetup, page, PagingSetup.CreateDefaultPDFSmallRegularFont(), XParagraphAlignment.Left, page.Height - pagingSetup.MarginTop, pagingSetup.SmallLineHeight, labName); } } }
public static void DrawReportHeader(PagingSetup pagingSetup, PdfDocument document, string reportHeader, string LabID) { //DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFSmallBoldFont(), // XParagraphAlignment.Center, pagingSetup.SmallLineHeight, "VIỆN VỆ SINH DỊCH TỄ"); string labName = HeaderService.GetHeader(LabID).Lab == null ? "" : HeaderService.GetHeader(LabID).Lab.Trim(); if (labName != "") { DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFSmallBoldFont(), XParagraphAlignment.Center, pagingSetup.SmallLineHeight, labName); } string address = HeaderService.GetHeader(LabID).Address == null ? "" : HeaderService.GetHeader(LabID).Address.Trim(); if (address != "") { DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFSmallRegularFont(), XParagraphAlignment.Center, pagingSetup.SmallLineHeight, address); } string phone = HeaderService.GetHeader(LabID).Phone == null ? "" : HeaderService.GetHeader(LabID).Phone.Trim(); if (phone != "") { DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFSmallRegularFont(), XParagraphAlignment.Center, pagingSetup.SmallLineHeight, phone); } IncreaseLineHeight(pagingSetup, document, pagingSetup.BoldLineHeight); DrawParagraphLine(pagingSetup, document, pagingSetup.HeaderFont, XParagraphAlignment.Center, pagingSetup.BoldLineHeight, reportHeader); }