Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Form 클래스는 정적 AcroForm을 처리할 수 있는 기능을 제공하며, Form 클래스의 GetFieldFacade(..) 메서드를 사용하여 특정 필드 인스턴스를 가져올 수 있습니다. 그러나 XFA 필드는 Form.GetFieldFacade(..) 메서드를 통해 접근할 수 없습니다. 대신 Document.Form.XFA를 사용하여 필드 값을 가져오거나 설정하고 XFA 필드 템플릿을 조작하십시오(필드 속성 설정).
다음 코드 스니펫은 Aspose.PDF.Drawing 라이브러리와 함께 작동합니다.
다음 코드 스니펫은 XFA 양식에서 필드를 채우는 방법을 보여줍니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void FillXFAFields()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Forms();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "FillXFAFields.pdf"))
{
// Get names of XFA form fields
var names = document.Form.XFA.FieldNames;
// Set field values
if (names.Length > 0)
{
document.Form.XFA[names[0]] = "Field 0";
}
if (names.Length > 1)
{
document.Form.XFA[names[1]] = "Field 1";
}
// Save PDF document
document.Save(dataDir + "FilledXfa_out.pdf");
}
}
동적 양식은 XFA로 알려진 XML 사양을 기반으로 하며, “XML 양식 아키텍처"입니다. 양식에 대한 정보(PDF와 관련하여)는 매우 모호합니다. 필드가 존재하며 속성과 JavaScript 이벤트가 있지만 렌더링에 대한 명시는 없습니다.
현재 PDF는 데이터와 PDF 양식을 통합하기 위한 두 가지 방법을 지원합니다:
XFA 양식의 페이지를 추출하거나 조작할 수 없습니다. 왜냐하면 양식 내용이 XFA 양식을 표시하거나 렌더링하려고 하는 애플리케이션 내에서 런타임에 생성되기 때문입니다. Aspose.PDF는 개발자가 XFA 양식을 표준 AcroForms로 변환할 수 있는 기능을 제공합니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ConvertDynamicXFAToAcroForm()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Forms();
// Load dynamic XFA form
using (var document = new Aspose.Pdf.Document(dataDir + "DynamicXFAToAcroForm.pdf"))
{
// Set the form fields type as standard AcroForm
document.Form.Type = Aspose.Pdf.Forms.FormType.Standard;
// Save PDF document
document.Save(dataDir + "StandardAcroForm_out.pdf");
}
}
필드 속성에 접근하려면 먼저 Document.Form.XFA.Template를 사용하여 필드 템플릿에 접근하십시오. 다음 코드 스니펫은 XFA 양식 필드의 X 및 Y 좌표를 가져오는 단계를 보여줍니다.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void GetXFAProperties()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Forms();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "GetXFAProperties.pdf"))
{
// Get names of XFA form fields
var names = document.Form.XFA.FieldNames;
// Set field values
if (names.Length > 0)
{
document.Form.XFA[names[0]] = "Field 0";
}
if (names.Length > 1)
{
document.Form.XFA[names[1]] = "Field 1";
}
// Get field position
if (names.Length > 0)
{
Console.WriteLine(document.Form.XFA.GetFieldTemplate(names[0]).Attributes["x"].Value);
Console.WriteLine(document.Form.XFA.GetFieldTemplate(names[0]).Attributes["y"].Value);
}
// Save PDF document
document.Save(dataDir + "FilledXfa_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.