Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
تتيح لك طريقة DecorateField الموجودة في فئة FormEditor تزيين حقل نموذج معين في ملف PDF. إذا كنت ترغب في تزيين حقل معين، فيجب عليك تمرير اسم الحقل إلى هذه الطريقة. ومع ذلك، قبل استدعاء هذه الطريقة، تحتاج إلى إنشاء كائنات من فئات FormEditor و FormFieldFacade. تحتاج أيضًا إلى تعيين كائن FormFieldFacade إلى خاصية Facade لكائن FormEditor. بعد ذلك، يمكنك تعيين أي سمات يوفرها كائن FormFieldFacade. بمجرد تعيين السمات، يمكنك استدعاء طريقة DecorateField وأخيرًا حفظ ملف PDF المحدث باستخدام طريقة Save لفئة FormEditor. تظهر لك الشيفرة البرمجية التالية كيفية تزيين حقل نموذج معين.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void DecorateField()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create an instance of FormEditor to manipulate form fields
using (var editor = new Aspose.Pdf.Facades.FormEditor())
{
// Bind PDF document
editor.BindPdf(dataDir + "Sample-Form-01.pdf");
// Create a FormFieldFacade object to define decoration properties for the field
var cityDecoration = new Aspose.Pdf.Facades.FormFieldFacade
{
// Set the font style to Courier
Font = Aspose.Pdf.Facades.FontStyle.Courier,
// Set the font size to 12
FontSize = 12,
// Set the border color to black
BorderColor = System.Drawing.Color.Black,
// Set the border width to 2
BorderWidth = 2
};
// Assign the decoration facade to the FormEditor
editor.Facade = cityDecoration;
// Apply the decoration to the field named "City"
editor.DecorateField("City");
// Save PDF document
editor.Save(dataDir + "Sample-Form-02.pdf");
}
}
تتيح لك طريقة DecorateField تزيين جميع حقول النموذج من نوع معين في ملف PDF دفعة واحدة. إذا كنت ترغب في تزيين جميع حقول نوع معين، فيجب عليك تمرير نوع الحقل إلى هذه الطريقة. ومع ذلك، قبل استدعاء هذه الطريقة، تحتاج إلى إنشاء كائنات من فئات FormEditor و FormFieldFacade. تحتاج أيضًا إلى تعيين كائن FormFieldFacade إلى خاصية Facade لكائن FormEditor. بعد ذلك، يمكنك تعيين أي سمات يوفرها كائن FormFieldFacade. بمجرد تعيين السمات، يمكنك استدعاء طريقة DecorateField وأخيرًا حفظ ملف PDF المحدث باستخدام طريقة Save لفئة FormEditor. تظهر لك الشيفرة البرمجية التالية كيفية تزيين جميع حقول نوع معين.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void DecorateField2()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create an instance of FormEditor to manipulate form fields
using (var editor = new Aspose.Pdf.Facades.FormEditor())
{
// Bind PDF document
editor.BindPdf(dataDir + "Sample-Form-01.pdf");
// Create a FormFieldFacade object to define alignment properties for text fields
var textFieldDecoration = new Aspose.Pdf.Facades.FormFieldFacade
{
// Set text alignment to center
Alignment = Aspose.Pdf.Facades.FormFieldFacade.AlignCenter
};
// Assign the decoration facade to the FormEditor
editor.Facade = textFieldDecoration;
// Apply the alignment decoration to all text fields in the PDF
editor.DecorateField(Aspose.Pdf.Facades.FieldType.Text);
// Save PDF document
editor.Save(dataDir + "Sample-Form-01-align-text.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.