Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
يمكن للمطورين استخدام مساحة أسماء Aspose.Pdf.Facades ليس فقط لإضافة نماذج جديدة وحقول نموذج في مستند PDF، ولكن أيضًا للسماح لك بتحرير الحقول الموجودة. نطاق هذه المقالة محدود بميزات Aspose.PDF for .NET التي تتعامل مع تحرير النماذج.
FormEditor هي الفئة التي تحتوي على معظم الطرق والخصائص التي تسمح للمطورين بتحرير حقول النموذج. يمكنك ليس فقط إضافة حقول جديدة، ولكن أيضًا إزالة الحقول الموجودة، ونقل حقل إلى موضع آخر، وتغيير اسم الحقل، أو الخصائص، وما إلى ذلك. قائمة الميزات المقدمة من هذه الفئة شاملة للغاية، ومن السهل جدًا العمل مع حقول النموذج باستخدام هذه الفئة.
يمكن تقسيم هذه الطرق إلى فئتين رئيسيتين، واحدة منها تستخدم للتلاعب بالحقول، والأخرى تستخدم لتعيين الخصائص الجديدة لهذه الحقول. تشمل الطرق التي يمكننا تجميعها تحت الفئة الأولى AddField وAddListItem وRemoveListItem وCopyInnerField وCopyOuterField وDelListItem وMoveField وRemoveField وRenameField، وما إلى ذلك. في الفئة الثانية من الطرق يمكن تضمين SetFieldAlignment وSetFieldAppearance وSetFieldAttribute وSetFieldLimit وSetFieldScript. يوضح مقتطف الكود التالي بعض طرق فئة FormEditor أثناء العمل.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.Pdf-for-.NET
private static void ExploringFormEditorFeatures()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "inFile.pdf"))
{
// Create instance of FormEditor
using (var editor = new Aspose.Pdf.Facades.FormEditor(document))
{
// Add field in the PDF file
editor.AddField(Aspose.Pdf.Facades.FieldType.Text, "field1", 1, 300, 500, 350, 525);
// Add List field in PDF file
editor.AddField(Aspose.Pdf.Facades.FieldType.ListBox, "field2", 1, 300, 200, 350, 225);
// Add list items
editor.AddListItem("field2", "item 1");
editor.AddListItem("field2", "item 2");
// Add submit button
editor.AddSubmitBtn("submitbutton", 1, "Submit Form", "http:// Testwebsite.com/testpage", 200, 200, 250, 225);
// Delete list item
editor.DelListItem("field2", "item 1");
// Move field to new position
editor.MoveField("field1", 10, 10, 50, 50);
// Remove existing field from the PDF
editor.RemoveField("field1");
// Rename an existing field
editor.RenameField("field1", "newfieldname");
// Reset all visual attributes to empty value
editor.ResetFacade();
// Set the alignment style of a text field
editor.SetFieldAlignment("field1", Aspose.Pdf.Facades.FormFieldFacade.AlignLeft);
// Set appearance of the field
editor.SetFieldAppearance("field1", Aspose.Pdf.Annotations.AnnotationFlags.NoRotate);
// Set field attributes i.e. ReadOnly, Required
editor.SetFieldAttribute("field1", Aspose.Pdf.Facades.PropertyFlag.ReadOnly);
// Set field limit
editor.SetFieldLimit("field1", 25);
// Save modifications in the output file
editor.Save(dataDir + "FormEditorFeatures2_out.pdf");
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.