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 객체를 FormEditor 객체의 Facade 속성에 할당해야 합니다. 그 후, FormFieldFacade 객체가 제공하는 속성을 설정할 수 있습니다. 속성을 설정한 후에는 DecorateField 메서드를 호출하고 마지막으로 FormEditor 클래스의 Save 메서드를 사용하여 업데이트된 PDF를 저장할 수 있습니다. 다음 코드 스니펫은 특정 양식 필드를 장식하는 방법을 보여줍니다.
// 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 객체를 FormEditor 객체의 Facade 속성에 할당해야 합니다. 그 후, FormFieldFacade 객체가 제공하는 속성을 설정할 수 있습니다. 속성을 설정한 후에는 DecorateField 메서드를 호출하고 마지막으로 FormEditor 클래스의 Save 메서드를 사용하여 업데이트된 PDF를 저장할 수 있습니다. 다음 코드 스니펫은 특정 유형의 모든 필드를 장식하는 방법을 보여줍니다.
// 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.