Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
如果您想将表单字段移动到新位置,则可以使用MoveField方法的FormEditor类。您只需提供字段名称和该字段的新位置给MoveField方法。您还需要使用FormEditor类的Save方法保存更新后的PDF文件。以下代码片段向您展示了如何在PDF文件中将表单字段移动到新位置。
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void MoveField()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Forms();
using (var editor = new Aspose.Pdf.Facades.FormEditor())
{
// Bind PDF document
editor.BindPdf(dataDir + "MoveField.pdf");
editor.MoveField("textbox1", 262.56f, 496.75f, 382.28f, 514.03f);
// Save PDF document
editor.Save(dataDir + "MoveField_out.pdf");
}
}
为了从现有PDF文件中删除表单字段,您可以使用FormEditor类的RemoveField方法。此方法只接受一个参数:字段名称。您需要创建FormEditor类的对象,调用RemoveField方法以从PDF中删除特定字段,然后调用Save方法以保存更新后的PDF文件。以下代码片段向您展示了如何从现有PDF文件中删除表单字段。
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void RemoveFields()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Forms();
using (var editor = new Aspose.Pdf.Facades.FormEditor())
{
// Bind PDF document
editor.BindPdf(dataDir + "ModifyFormField.pdf");
editor.RemoveField("textbox1");
// Save PDF document
editor.Save(dataDir + "RemoveField_out.pdf");
}
}
您还可以使用FormEditor类的RenameField方法重命名您的字段。
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void RenameFields()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Forms();
using (var editor = new Aspose.Pdf.Facades.FormEditor())
{
// Bind PDF document
editor.BindPdf(dataDir + "ModifyFormField.pdf");
editor.RenameField("textbox1", "FirstName");
// Save PDF document
editor.Save(dataDir + "RenameField_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.