private void AddFooter(Section section) { //var footer = section.Footers.Primary.AddParagraph(); //footer.Format.AddTabStop(Size.GetWidth(section), TabAlignment.Right); //footer.AddTab(); //footer.AddText("Symphony Media -Linear");//Here need to print Client Short Name //footer.AddTab(); //footer.AddText("Page "); //footer.AddPageField(); //footer.AddText(" of "); //footer.AddNumPagesField(); Paragraph leftFooter = section.Footers.Primary.AddParagraph(); leftFooter.Format.Font.Size = 10; leftFooter.Format.Alignment = ParagraphAlignment.Right; leftFooter.AddText("Symphony Media -Linear"); Paragraph rightFooter = section.Footers.Primary.AddParagraph(); rightFooter.Format.Font.Size = 10; rightFooter.Format.Alignment = ParagraphAlignment.Center; rightFooter.AddText("Page "); rightFooter.AddPageField(); rightFooter.AddText(" of "); rightFooter.AddNumPagesField(); }
private void AddDocumentFooter() { if (String.IsNullOrWhiteSpace(DocumentFooter) && ShowPageNumber == false) { return; // Don't add any footer } var section = Document.LastSection; var footer1 = new Paragraph(); if (!String.IsNullOrWhiteSpace(DocumentFooter)) { footer1.Style = StyleNames.Footer; footer1.AddText(DocumentFooter); if (ShowPageNumber) { footer1.AddLineBreak(); } } if (ShowPageNumber) { footer1.AddText("Page "); footer1.AddPageField(); footer1.AddText(" of "); footer1.AddNumPagesField(); } section.Footers.Primary.Add(footer1.Clone()); section.Footers.FirstPage.Add(footer1.Clone()); }
private static void CreateNewSection(ref Document workingDoc, string sectionHead) { workingDoc.AddSection(); workingDoc.LastSection.PageSetup.TopMargin = Unit.FromInch(.25); workingDoc.LastSection.PageSetup.BottomMargin = Unit.FromInch(.5); workingDoc.LastSection.PageSetup.LeftMargin = Unit.FromInch(.25); workingDoc.LastSection.PageSetup.RightMargin = Unit.FromInch(.25); workingDoc.LastSection.AddParagraph(sectionHead, "Heading1"); if (_rowBreak != null && _rowBreak != "" && sectionHead != "") { //workingDoc.LastSection.Headers.Primary.AddParagraph(sectionHead); //workingDoc.LastSection.PageSetup.HeaderDistance = new Unit(.75, UnitType.Inch); //workingDoc.LastSection.AddParagraph(sectionHead, "Heading1"); workingDoc.LastSection.Headers.Primary.AddParagraph(_rowBreak + ":" + sectionHead); } Unit myFooter = new Unit(.20, UnitType.Inch); workingDoc.LastSection.PageSetup.FooterDistance = myFooter; //workingDoc.DefaultPageSetup.FooterDistance = myFooter; Paragraph pFooter = new Paragraph(); pFooter.AddText("Page "); pFooter.AddPageField(); pFooter.AddText(" of "); pFooter.AddNumPagesField(); workingDoc.LastSection.Footers.Primary.Add(pFooter); }
public void FooterSection() { HeaderFooter footer = Pdf.LastSection.Footers.Primary; Table table = footer.AddTable(); table.AddColumn(footer.Section.PageWidth() / 2); table.AddColumn(footer.Section.PageWidth() / 2); Row row = table.AddRow(); if (!string.IsNullOrEmpty(Invoice.Footer)) { Paragraph paragraph = row.Cells[0].AddParagraph(Invoice.Footer, ParagraphAlignment.Left, "H2-8-Blue"); Hyperlink link = paragraph.AddHyperlink(Invoice.Footer, HyperlinkType.Web); } Paragraph info = row.Cells[1].AddParagraph(); info.Format.Alignment = ParagraphAlignment.Right; info.Style = "H2-8"; info.AddText("Page "); info.AddPageField(); info.AddText(" of "); info.AddNumPagesField(); }
public void FooterSection() { HeaderFooter footer = Pdf.LastSection.Footers.Primary; Table table = footer.AddTable(); table.AddColumn(footer.Section.PageWidth()); table.AddColumn(footer.Section.PageWidth() / 10); Row row = table.AddRow(); if (Invoice.Company.HasLegalTextLines) { foreach (var line in Invoice.Company.LegalTextLines) { row.Cells[0].AddParagraph(line, ParagraphAlignment.Center, "H2-9"); } } row.Cells[1].AddParagraph(); Paragraph info = row.Cells[1].AddParagraph(); info.Format.Alignment = ParagraphAlignment.Right; info.Style = "H2-9"; info.AddPageField(); info.AddText(" / "); info.AddNumPagesField(); }
static void section(Document document) { Section section = document.AddSection(); section.PageSetup.OddAndEvenPagesHeaderFooter = true; section.PageSetup.StartingNumber = 1; Table table = new Table(); table.Borders.Width = 0.2; Column column = table.AddColumn(Unit.FromCentimeter(2)); column = table.AddColumn(Unit.FromCentimeter(4)); column = table.AddColumn(Unit.FromCentimeter(4)); column = table.AddColumn(Unit.FromCentimeter(4)); column.Format.Alignment = ParagraphAlignment.Center; table.AddColumn(Unit.FromCentimeter(4)); Paragraph paragraph = new Paragraph(); paragraph.AddTab(); paragraph.AddPageField(); section.Footers.Primary.Add(table); }
/// <summary> /// Defines page setup, headers, and footers. /// </summary> static void DefineContentSection(Document document) { Section section = document.AddSection(); section.PageSetup.OddAndEvenPagesHeaderFooter = true; section.PageSetup.StartingNumber = 1; HeaderFooter header = section.Headers.Primary; header.AddParagraph("\tOdd Page Header"); header = section.Headers.EvenPage; header.AddParagraph("Even Page Header"); // Create a paragraph with centered page number. See definition of style "Footer". Paragraph paragraph = new Paragraph(); paragraph.AddTab(); paragraph.AddPageField(); // Add paragraph to footer for odd pages. section.Footers.Primary.Add(paragraph); // Add clone of paragraph to footer for odd pages. Cloning is necessary because an object must // not belong to more than one other object. If you forget cloning an exception is thrown. section.Footers.EvenPage.Add(paragraph.Clone()); }
public Section CreateDocumentSection() { Section section = _document.AddSection(); // Set section footer Paragraph paragraph = new Paragraph(); paragraph.Format.Font.Size = 6; paragraph.Format.Alignment = ParagraphAlignment.Right; paragraph.Format.Font.Italic = false; paragraph.Format.Font.Color = Colors.DarkGray; paragraph.AddText($"Powered by {AppConstants.AppTitle} {AppConstants.AppVersion}"); paragraph.AddSpace(3); paragraph.AddText("|"); paragraph.AddSpace(3); paragraph.AddText(Phrases.GlobalPage); paragraph.AddSpace(1); paragraph.AddPageField(); paragraph.AddSpace(1); paragraph.AddText(Phrases.GlobalOf); paragraph.AddSpace(1); paragraph.AddNumPagesField(); section.Footers.Primary.Add(paragraph); section.Footers.EvenPage.Add(paragraph.Clone()); return(section); }
public static Document CreateDocument(string Propriedade, string Nome = "", string InscricaoEstadual = "") { Section section; Document doc; doc = new Document(); section = doc.AddSection(); section.PageSetup.OddAndEvenPagesHeaderFooter = true; section.AddParagraph("RELATÓRIO - " + Convert.ToString(DateTime.Now.Date)).Format.Alignment = ParagraphAlignment.Center; section.AddParagraph("Proprietário: " + Nome); section.AddParagraph("Inscrição Estadual: " + InscricaoEstadual); section.AddParagraph("Propriedade: " + Propriedade); section.AddParagraph(); Paragraph paragraph = new Paragraph(); paragraph.AddText("Página "); paragraph.AddPageField(); paragraph.AddText(" de "); paragraph.AddNumPagesField(); section.Footers.Primary.Add(paragraph); section.Footers.EvenPage.Add(paragraph.Clone()); section.PageSetup.Orientation = Orientation.Landscape; DefineStyles(doc); return(doc); }
private void PageSettings(Section section) { Paragraph naglowek = section.Headers.Primary.AddParagraph(); naglowek.Format.Font.Underline = Underline.Single; // vugraph.tytul = "EJCH"; naglowek.AddFormattedText("European Youth Bridge Championship"); // string tekst = vugraph.tytul; // if (tekst.Count() > 40) // tekst = tekst.Substring(0, 40); naglowek.AddSpace(5); naglowek.AddImage("images\\mini_b24dwa.jpg"); naglowek.AddSpace(10); naglowek.AddFormattedText(game.data.ToShortDateString()); Paragraph stopka = section.Footers.Primary.AddParagraph(); stopka.Format.Borders.Top.Width = Unit.FromCentimeter(0.1); stopka.AddFormattedText(mail); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.Format.Alignment = ParagraphAlignment.Justify; stopka.AddFormattedText("Strona "); stopka.AddPageField(); stopka.AddFormattedText(" z " + (Ustawienia.ilosc_rozdan + 2).ToString()); }
private void PageSettings(Section section) { Paragraph naglowek = section.Headers.Primary.AddParagraph(); naglowek.Format.Font.Underline = Underline.Single; naglowek.AddFormattedText("Trening licytacyjny"); naglowek.AddSpace(22); naglowek.AddImage("images\\mini_b24dwa.jpg"); naglowek.AddSpace(15); naglowek.AddFormattedText(DateTime.Now.ToShortDateString()); Paragraph stopka = section.Footers.Primary.AddParagraph(); stopka.Format.Borders.Top.Width = Unit.FromCentimeter(0.1); stopka.AddFormattedText(mail); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddSpace(4); stopka.Format.Alignment = ParagraphAlignment.Justify; stopka.AddFormattedText("Strona "); stopka.AddPageField(); stopka.AddFormattedText(" z " + (Ustawienia.ilosc_rozdan + 1).ToString()); }
/// <summary> /// Tworzy stopkę - na podstawie zmiennej tekststopki. Dodaje także nr strony "Strona X". Formatowanie na sztywno, ale zalezne od szerokosci strony. /// </summary> /// <returns>Ramka tekstowa z zawartoscią tego co ma być w stopce</returns> protected TextFrame SetFooter() { TextFrame frame = new TextFrame(); Table footer = new Table(); double szerokosc_kolumny = szerokosc_strony / 2; frame.Width = Unit.FromCentimeter(szerokosc_strony); frame.Height = Unit.FromCentimeter(0.6); for (int i = 0; i < 2; i++) { footer.AddColumn(Unit.FromCentimeter(szerokosc_kolumny)); } footer.AddRow(); footer.Borders.Top.Width = 1.0; Paragraph p = new Paragraph(); p.AddFormattedText(stopkaTekst, new Font("Verdana", 10)); p.Format.Alignment = ParagraphAlignment.Left; footer[0, 0].Add(p); p = new Paragraph(); p.AddFormattedText(napis_strona, new Font("Verdana", 10)); p.AddPageField(); footer[0, 1].Add(p); footer.Format.Alignment = ParagraphAlignment.Right; frame.Add(footer); return(frame); }
private void PageSettings(Section section) { Paragraph naglowek = section.Headers.Primary.AddParagraph(); naglowek.Format.Font.Underline = Underline.Single; naglowek.AddFormattedText(vugraph1.tytul); string tekst = vugraph1.tytul; if (tekst.Count() > 40) { tekst = tekst.Substring(0, 40); } naglowek.AddSpace(40 - vugraph1.tytul.Count()); naglowek.AddImage("images\\mini_b24dwa.jpg"); naglowek.AddSpace(15); naglowek.AddFormattedText(DateTime.Now.ToShortDateString()); Paragraph stopka = section.Footers.Primary.AddParagraph(); stopka.Format.Borders.Top.Width = Unit.FromCentimeter(0.1); stopka.AddFormattedText(mail); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddSpace(4); stopka.Format.Alignment = ParagraphAlignment.Justify; stopka.AddFormattedText("Strona "); stopka.AddPageField(); stopka.AddFormattedText(" z " + (Ustawienia.ilosc_rozdan + 1).ToString()); }
private MigraDoc.DocumentObjectModel.Document CreatePrintDocument(PrintDocument pd) { string text; MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document(); doc.DefaultPageSetup.PageWidth = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Width / 100); doc.DefaultPageSetup.PageHeight = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Height / 100); doc.DefaultPageSetup.TopMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Top / 100); doc.DefaultPageSetup.LeftMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Left / 100); doc.DefaultPageSetup.RightMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Right / 100); doc.DefaultPageSetup.BottomMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Bottom / 100); MigraDoc.DocumentObjectModel.Section section = doc.AddSection(); section.PageSetup.StartingNumber = 1; MigraDoc.DocumentObjectModel.Font headingFont = MigraDocHelper.CreateFont(13, true); MigraDoc.DocumentObjectModel.Font bodyFontx = MigraDocHelper.CreateFont(9, false); MigraDoc.DocumentObjectModel.Font nameFontx = MigraDocHelper.CreateFont(9, true); MigraDoc.DocumentObjectModel.Font totalFontx = MigraDocHelper.CreateFont(9, true); Paragraph pageNumParag = new Paragraph(); pageNumParag.AddText(Lan.g(this, "Page") + " "); pageNumParag.AddPageField(); pageNumParag.AddText(" " + Lan.g(this, "of") + " "); pageNumParag.AddNumPagesField(); section.Footers.Primary.Add(pageNumParag); Paragraph par = section.AddParagraph(); ParagraphFormat parformat = new ParagraphFormat(); parformat.Alignment = ParagraphAlignment.Center; parformat.Font = MigraDocHelper.CreateFont(14, true); par.Format = parformat; //Render the reconcile grid. par = section.AddParagraph(); par.Format.Alignment = ParagraphAlignment.Center; par.AddFormattedText(Lan.g(this, "RECONCILE"), totalFontx); par.AddLineBreak(); text = Accounts.GetAccount(ReconcileCur.AccountNum).Description.ToUpper(); par.AddFormattedText(text, totalFontx); par.AddLineBreak(); text = PrefC.GetString(PrefName.PracticeTitle); par.AddText(text); par.AddLineBreak(); text = PrefC.GetString(PrefName.PracticePhone); if (text.Length == 10 && Application.CurrentCulture.Name == "en-US") { text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6); } par.AddText(text); par.AddLineBreak(); par.AddText(MiscData.GetNowDateTime().ToShortDateString()); par.AddLineBreak(); par.AddText(Lan.g(this, "Reconcile Date") + ": " + PIn.Date(textDate.Text).ToShortDateString()); par.AddLineBreak(); par.AddText(labelStart.Text + ": " + PIn.Double(textStart.Text).ToString("n")); par.AddLineBreak(); par.AddText(labelEnd.Text + ": " + PIn.Double(textEnd.Text).ToString("n")); MigraDocHelper.InsertSpacer(section, 10); MigraDocHelper.DrawGrid(section, gridMain); return(doc); }
/// <summary> /// Defines page setup, headers, and footers /// </summary> /// <param name="document">MigraDoc document created via Documents.CreateDocument()</param> public static void DefineContentSection(Document document) { Section section = document.AddSection(); section.PageSetup.TopMargin = "5cm"; section.PageSetup.StartingNumber = 1; section.PageSetup.Orientation = Orientation.Landscape; // Create header HeaderFooter header = section.Headers.Primary; // Add logo Image image = header.AddImage(Report.logoPath); image.Width = "8cm"; image.WrapFormat.Style = WrapStyle.Through; // Add company name Paragraph h1 = new Paragraph(); h1.AddText(Report.companyName); h1.Format.Font.Color = Colors.SlateGray; h1.Format.Font.Size = 24; h1.Format.Font.Bold = true; header.Add(h1); // Add report name Paragraph h2 = new Paragraph(); h2.Format.Font.Color = Colors.SlateGray; h2.AddText("Welfare Check Breach Report"); h2.Format.Font.Size = 18; h2.Format.Borders.Width = 0; h2.Format.Borders.Bottom.Width = 1; h2.Format.Borders.Color = Colors.LightSlateGray; h2.Format.Borders.Distance = 4; header.Add(h2); // Add current date Paragraph h3 = new Paragraph(); h3.Format.Font.Size = 12; h3.Format.Font.Italic = true; h3.Format.Borders.Distance = 6; h3.AddDateField(); header.Add(h3); // Create a paragraph with centered page number. See definition of style "Footer". Paragraph footer = new Paragraph(); footer.Format.Borders.Width = 0; footer.Format.Borders.Top.Width = 1; footer.Format.Borders.Color = Colors.LightSlateGray; footer.Format.Borders.Distance = 10; footer.AddPageField(); // Add paragraph to footer section.Footers.Primary.Add(footer); }
/// <summary> /// adjust the footer on the PDF /// </summary> private void addFooterToPDF() { Section footer = doc.LastSection; Paragraph paragraph = footer.Footers.Primary.AddParagraph(); paragraph.AddPageField(); footer.PageSetup.StartingNumber = 1; }
private void showPageNumber() { Paragraph pageNumber = new Paragraph(); pageNumber.AddText("Page "); pageNumber.AddPageField(); pageNumber.AddText(" of "); pageNumber.AddNumPagesField(); section.Footers.Primary.Add(pageNumber); }
/// <summary> /// Helper method to set styles for page numbers in header/footer. /// Page numbers are always aligned to the right. /// </summary> /// <param name="style"></param> /// <param name="pagenumField"></param> private static void FormatPagenumField(Style style, Paragraph pagenumField) { pagenumField.Style = style.Name; pagenumField.Format.Alignment = ParagraphAlignment.Right; pagenumField.Format.Font.Color = Colors.Black; pagenumField.AddPageField(); pagenumField.AddText(" ("); pagenumField.AddNumPagesField(); pagenumField.AddText(")"); }
/// <summary> /// Defines page setup, headers, and footers. /// </summary> private void DefineContentSection(Document document, Report report) { Section section = document.AddSection(); section.PageSetup.OddAndEvenPagesHeaderFooter = true; section.PageSetup.StartingNumber = 1; section.PageSetup.Orientation = (this.Landscape ? Orientation.Landscape : Orientation.Portrait); HeaderFooter header = section.Headers.Primary; header.AddParagraph(report.TextFields.Footer); header = section.Headers.EvenPage; header.AddParagraph(report.TextFields.Footer); // Create a paragraph with centered page number. See definition of style "Footer". Paragraph paragraph = new Paragraph(); paragraph.AddTab(); paragraph.AddPageField(); // Add paragraph to footer for odd pages. section.Footers.Primary.Add(paragraph); // Add clone of paragraph to footer for odd pages. Cloning is necessary because an object must // not belong to more than one other object. If you forget cloning an exception is thrown. section.Footers.EvenPage.Add(paragraph.Clone()); paragraph = document.LastSection.AddParagraph(); paragraph.Format.Alignment = ParagraphAlignment.Center; paragraph.Format.Font.Bold = true; paragraph.Format.Font.Color = Colors.DarkBlue; paragraph.Format.Font.Size = 14; paragraph.AddText(report.TextFields.Title); paragraph = document.LastSection.AddParagraph(); paragraph.AddText(""); paragraph = document.LastSection.AddParagraph(); paragraph.Format.Alignment = ParagraphAlignment.Center; paragraph.Format.Font.Bold = true; paragraph.Format.Font.Size = 12; paragraph.Format.Font.Color = Colors.DarkBlue; paragraph.AddText(report.TextFields.SubTitle); paragraph = document.LastSection.AddParagraph(); paragraph.AddText(""); paragraph = document.LastSection.AddParagraph(); paragraph.Format.Alignment = ParagraphAlignment.Left; paragraph.Format.Font.Bold = true; paragraph.AddText(report.TextFields.Header); paragraph = document.LastSection.AddParagraph(); paragraph.AddText(""); }
public DocBuilder AddPageNumber() { var paragraph = new Paragraph(); paragraph.AddText("Page "); paragraph.AddPageField(); paragraph.AddText(" of "); paragraph.AddNumPagesField(); section.Footers.Primary.Add(paragraph); return(this); }
private void CriarRodape() { Paragraph rodapeHr = _document.Sections[0].Footers.Primary.AddParagraph(); rodapeHr.Format.Borders.Top = new Border { Width = "1pt", Color = Colors.DarkGreen }; rodapeHr.Format.Alignment = ParagraphAlignment.Right; rodapeHr.AddText("Página "); rodapeHr.AddPageField(); rodapeHr.AddText(" de "); rodapeHr.AddNumPagesField(); }
// [UnitTestFunction] public static void TestFields() { Document doc = new Document(); doc.Info.Author = "K.P."; Section sec = doc.Sections.AddSection(); Paragraph par = sec.AddParagraph(); par.AddBookmark("myBookmark1"); PageRefField prf = par.AddPageRefField("myBookmark1"); prf.Format = "ALPHABETIC"; PageField pf = par.AddPageField(); pf.Format = "ROMAN"; SectionField sf = par.AddSectionField(); sf.Format = "roman"; SectionPagesField spf = par.AddSectionPagesField(); spf.Format = "roman"; NumPagesField npf = par.AddNumPagesField(); npf.Format = "alphabetic"; InfoField inf = par.AddInfoField(InfoFieldType.Author); DateField df = par.AddDateField("D"); df = par.AddDateField("d"); df = par.AddDateField("s"); df = par.AddDateField("r"); df = par.AddDateField("G"); df = par.AddDateField("dddd dd.MM.yyyy"); DocumentRenderer docRndrr = new DocumentRenderer(); docRndrr.Render(doc, "RtfFields.txt", null); File.Copy("RtfFields.txt", "RtfFields.rtf", true); System.Diagnostics.Process.Start("RtfFields.txt"); }
private void createUsFooterSection(Table footerTable) { Row footerRow1 = footerTable.AddRow(); footerTable.Style = "footerStyle"; Paragraph addressParagraph = footerRow1.Cells[1].AddParagraph(); addressParagraph.AddText("Machine Tool Technology, Inc., Registered Office: 7 Burroughs,"); Row footerRow2 = footerTable.AddRow(); Paragraph addressPara2 = footerRow2.Cells[1].AddParagraph(); addressPara2.AddText("Irvine, California, 92618, USA."); Row footerRow3 = footerTable.AddRow(); Paragraph addressPara3 = footerRow3.Cells[1].AddParagraph(); addressPara3.AddText("Registered in California, USA. Entity Number C3844807"); Row footerRow4 = footerTable.AddRow(); Paragraph addressPara4 = footerRow4.Cells[1].AddParagraph(); addressPara4.AddText("Tel. (949) 697-9062 Web Address: www.mttinc.us.com"); //Merge the first cell, to contain the logo footerRow1.Cells[0].MergeDown = 3; footerRow1.Cells[2].MergeDown = 3; Paragraph pageNumberParagraph = footerRow1.Cells[2].AddParagraph(); pageNumberParagraph.AddPageField(); pageNumberParagraph.AddText(" ("); pageNumberParagraph.AddNumPagesField(); pageNumberParagraph.AddText(")"); footerRow1.Cells[2].Style = "Normal"; Image imgFooterLogo = Service_Reader.Properties.Resources.MTTIncHeaderlogo; string imageFileName = imageToMigradocString(imgFooterLogo); var mttIncFooter = footerRow1.Cells[0].AddImage(imageFileName); mttIncFooter.Height = new Unit(1.2, UnitType.Centimeter); }
static void ProjectOverview(Section section) { var paragraph = section.AddParagraph("Project Overview", "Title"); paragraph = section.AddParagraph("Theadvanced control strategy is implemented in a district heating system for social housing in Crutzestraat, Hasselt. " + "Thesocial housing is operated by Cordium, the operating manager for social housing in Flemish region.The project" + "consists of three phases or buildings with 20, 20 and 28 apartments in each phase.Each building has its own central" + "heating system with various technologies installed.Furthermore, central heating systems areinterconnected by an" + "internal heat transfer network.i.Leco developed thecontrol strategy which sends hourly setpoints fo: maximum and" + "minimum temperaturesetpoint in each building and/or distribution circuit, operation modes of installed technologies," + "and distribution statesettings between building/heating systems", "Zero"); section.PageSetup.DifferentFirstPageHeaderFooter = false; section.Footers.Primary.AddParagraph("i.Leco © 29/01/2021"); var number = new Paragraph(); number.AddTab(); number.AddTab(); number.AddPageField(); section.Footers.Primary.Add(number); }
/// <summary> /// Defines page setup, headers, and footers. /// </summary> static void DefineContentSection(Document document, ArticlesWithWordMigra article) { Section section = document.AddSection(); section.PageSetup.OddAndEvenPagesHeaderFooter = false; section.PageSetup.StartingNumber = 1; HeaderFooter header = section.Headers.Primary; header.AddParagraph(article.EditionName + "\t" + article.Url); // Create a paragraph with centered page number. See definition of style "Footer". Paragraph paragraph = new Paragraph(); paragraph.AddTab(); paragraph.AddPageField(); // Add paragraph to footer for odd pages. section.Footers.Primary.Add(paragraph); }
/// <summary> /// Renders the element. /// </summary> /// <param name="pdfStyling">The PDF styling.</param> /// <param name="section">The section.</param> public void Render(IPdfStyling pdfStyling, Section section) { section.PageSetup.StartingNumber = 1; TextFrame frame = section.Footers.Primary.AddTextFrame(); frame.Width = new Unit(pdfStyling.MaxWidthInPoints); frame.Height = new Unit(10); //TODO: Why? frame.MarginTop = pdfStyling.PageNumberMarginTop; //TODO: Why? //frame.MarginTop = new Unit(69.5); Paragraph paragraph = frame.AddParagraph(); paragraph.Format.Alignment = pdfStyling.PageNumberAlignment; //paragraph.AddText("Page "); //TODO: Multilingual paragraph.AddPageField(); paragraph.AddText(" / "); paragraph.AddNumPagesField(); paragraph.SetStyle(PdfStyleNames.Paragraph.Small); }
/// <summary> /// Basic export function to generate PDF from a list of elements /// </summary> /// <param name="pack">pack containing elements to export and arguments to specify the format</param> /// <returns>A PDF Document</returns> public PdfDocument ExportAll(Interfaces.IExportablePack <Competentie> pack) { Document prePdf = new Document(); //Document markup DefineStyles(prePdf); BuildCover(prePdf, "Competentie-Overzicht voor Informatica"); DefineTableOfContents(prePdf, pack.ToExport); //Here starts the real exporting CompetentieExporterFactory cef = new CompetentieExporterFactory(); competentieExporterStrategy = cef.GetStrategy(pack.Options as CompetentieExportArguments); foreach (DomainDAL.Competentie c in pack.ToExport) { Section sect = prePdf.AddSection(); try { sect = competentieExporterStrategy.Export(c, sect); } catch (Exception e) { sect.AddParagraph("An error has occured while invoking an export-function on Competentie: " + c.Naam + "\n" + e.Message, "error"); } //Page numbers (only for multi-export) Paragraph p = new Paragraph(); p.AddPageField(); sect.Footers.Primary.Add(p); sect.Footers.EvenPage.Add(p.Clone()); } PdfDocumentRenderer rend = new PdfDocumentRenderer(false, PdfFontEmbedding.Always); rend.Document = prePdf; rend.RenderDocument(); return(rend.PdfDocument); }
public static void Fields(string outputFile) { Document document = new Document(); Section section = document.AddSection(); Paragraph par = section.AddParagraph(); par.AddText("Section: "); par.AddSectionField().Format = "ALPHABETIC"; par.AddLineBreak(); par.AddText("SectionPages: "); par.AddSectionField().Format = "alphabetic"; par.AddLineBreak(); par.AddText("Page: "); par.AddPageField().Format = "ROMAN"; par.AddLineBreak(); par.AddText("NumPages: "); par.AddNumPagesField(); par.AddLineBreak(); par.AddText("Date: "); par.AddDateField(); par.AddLineBreak(); par.AddText("Bookmark: "); par.AddBookmark("Egal"); par.AddLineBreak(); par.AddText("PageRef: "); par.AddPageRefField("Egal"); PdfDocumentRenderer printer = new PdfDocumentRenderer() { Document = document }; printer.RenderDocument(CancellationToken.None); printer.PdfDocument.Save(outputFile); }
/// <summary> /// Defines page setup, headers, and footers. /// </summary> static void DefineContentSection(Document document) { Section section = document.AddSection(); section.PageSetup.StartingNumber = 1; HeaderFooter header = section.Headers.Primary; header.Format.Alignment = ParagraphAlignment.Right; header.AddParagraph("\t Page Header"); // Create a paragraph with centered page number. See definition of style "Footer". Paragraph paragraph = new Paragraph(); paragraph.AddTab(); paragraph.AddPageField(); // Add paragraph to footer for odd pages. section.Footers.Primary.Add(paragraph); }
/// <summary> /// Basic export function to generate PDF from a list of elements /// </summary> /// <param name="pack">pack containing elements to export and arguments to specify the format</param> /// <returns>A PDF Document</returns> public PdfDocument ExportAll(IExportablePack <FaseType> pack) { Document prePdf = new Document(); //Document markup DefineStyles(prePdf); BuildCover(prePdf, "Module-Overzicht voor Informatica"); DefineTableOfContents(prePdf, pack.ToExport); //Here starts the real exporting LessenTabelExporterFactory ltef = new LessenTabelExporterFactory(); lessenTabelExporterStrategy = ltef.GetStrategy(pack.Options as LessenTabelExportArguments); foreach (FaseType ft in pack.ToExport) { Section sect = prePdf.AddSection(); try { sect = lessenTabelExporterStrategy.Export(ft, sect); } catch (Exception e) { sect.AddParagraph("An error has occured while invoking an export-function on FaseType: " + ft.Type + "\n" + e.Message, "error"); } //Page numbers (only for multi-export) Paragraph p = new Paragraph(); p.AddPageField(); sect.Footers.Primary.Add(p); sect.Footers.EvenPage.Add(p.Clone()); } PdfDocumentRenderer rend = new PdfDocumentRenderer(false, PdfFontEmbedding.Always); rend.Document = prePdf; rend.RenderDocument(); return(rend.PdfDocument); }