C# PDF Page Parser Library
How to extract page data, replace PDF document pages using C#.net. Free Download
An Excellent PDF Control Allows C# Users to Replace the Original PDF Page with New PDF Page from Another PDF File in C#.NET
- Professional PDF SDK for Visual Studio .NET, which able to replace PDF page in C#.NET class
- Advanced PDF edit control and component for replacing PDF pages in both C#.NET WinForms
- Free online sample code for quick evaluation in Visual C#.NET framework for PDF page replacing
- Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
- Easy to replace PDF pages online in browser in ASP.NET web project
- Support to replace a PDF page with another PDF file page in .NET framework
- Support to save multiple PDF pages to anther PDF document by replacing
You can replace an entire PDF page with another PDF page from another PDF file. All information, data on the original page are removed, including text, images, interactive elements, such as links and bookmarks.
C# replace a single pdf page by another pdf page
#region replace a single pdf page by another pdf page
internal static void repaceSinglePage()
{
// load the PDF file that provides the page object
String resFilePath = @"C:\2.pdf";
PDFDocument resDoc = new PDFDocument(resFilePath);
// get the 1st page in the document
PDFPage page = (PDFPage)resDoc.GetPage(0);
// get PDFDocument object from a source file
String inputFilePath = @"C:\1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);
// replace the 3rd page by the PDFPage object
int pageIndex = 2;
doc.UpdatePage(page, pageIndex);
// save the PDFDocument
String outputFilePath = @"C:\Output.pdf";
doc.Save(outputFilePath);
}
#endregion
C# replace list of consecutive pages by another list of pdf pages
#region replace pdf pages by another pdf pages
internal static void repacePages()
{
// load the PDF file that provides the page object
String resFilePath = @"C:\2.pdf";
PDFDocument resDoc = new PDFDocument(resFilePath);
// get the 1st page in the document
PDFPage page1 = (PDFPage)resDoc.GetPage(0);
PDFPage page2 = (PDFPage)resDoc.GetPage(1);
PDFPage page3 = (PDFPage)resDoc.GetPage(2);
List<BasePage> pages = new List<BasePage>();
pages.Add(page1);
pages.Add(page2);
pages.Add(page3);
// get PDFDocument object from a source file
String inputFilePath = @"C:\1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);
// replace the 3rd page by the PDFPage object
int[] pageIndexes = new int[] { 5,6,7 };
doc.UpdatePages(pages.ToArray(), pageIndexes);
// save the PDFDocument
String outputFilePath = @"C:\Output.pdf";
doc.Save(outputFilePath);
}
#endregion
Replace a page (in a PDFDocument object) by a page object
// load the PDF file that provides the page object
String resFilePath = Program.RootPath + "\\" + "2.pdf";
PDFDocument resDoc = new PDFDocument(resFilePath);
// get the 1st page in the document
PDFPage page = (PDFPage)resDoc.GetPage(0);
// get PDFDocument object from a source file
String inputFilePath = Program.RootPath + "\\" + "1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);
// replace the 3rd page by the PDFPage object
int pageIndex = 2;
doc.UpdatePage(page, pageIndex);
// save the PDFDocument
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";
doc.Save(outputFilePath);