using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.Wordprocessing; public static void AddPageBreak(WordprocessingDocument document) { Body body = document.MainDocumentPart.Document.Body; Paragraph para = new Paragraph(new Run(new Break() { Type = BreakValues.Page })); body.AppendChild(para); }
using iTextSharp.text; using iTextSharp.text.pdf; public static void AddPageBreak(PdfWriter writer) { writer.NewPage(); }In both examples, we are using a different package library to perform the task. DocumentFormat.OpenXml is a library for handling OpenXML documents, while iTextSharp is a library for creating PDF files.