---
title: "PDF文档编辑：替换页面 — PDF SDK开发者文档Windows版"
canonical_url: "https://www.compdf.com/zh-cn/guides/pdf-sdk/windows/document-editor/replace-pages"
md_url: "https://www.compdf.com/zh-cn/guides/pdf-sdk/windows/document-editor/replace-pages.md"
description: "替换页面 — ComPDF PDF SDK (Windows). 以下是替换页面的步骤："
---

# 替换页面

以下是替换页面的步骤：

1.  移除目标文件需要被替换的页码。
2.  将替换页面插入原文档被删除的位置，完成页面的替换。

以下是替换页面的示例代码：

```C#
List<int> pageList = new List<int>() { 0 }; 
document.RemovePages(pageList.ToArray());// 移除文档的第一页。
CPDFDocument documentForInsert = CPDFDocument.InitWithFilePath("OtherPDF.pdf");
document.ImportPagesAtIndex(documentForInsert, "1", 0); // 将另一份文档的第一页插入原文档的第一页位置，完成替换。
```
