PDF processing control Aspose.PDF function demo: Convert XFA to AcroForms in PDF in C# and Java

Aspose.PDF  is an advanced PDF processing API that can easily generate, modify, convert, render, protect and print documents in cross-platform applications. No need to use Adobe Acrobat. Additionally, the API provides compression options, table creation and manipulation, graphics and image functionality, extensive hyperlink functionality, stamp and watermark tasks, extended security controls, and custom font handling.

Aspose API supports popular file format processing and allows exporting or converting various types of documents to fixed layout file formats and most commonly used image/multimedia formats. 

AcroForms are fillable forms for integrating form fields in PDF documents. This is the initial form technology adopted by Adobe for PDF documents starting with the PDF 1.2 specification. AcroForms allows form fields to be added as overlays to collect data from end users or anyone consuming the document.

Later, after Adobe acquired Accelio (a service provider), it made the XML-based XFA form (XML Forms Architecture) a part of the PDF 1.5 specification. XFA uses the power of XML to develop electronic forms in PDF documents. However, although XFA is a newer electronic forms technology compared to AcroForms, it has some limitations, including:

  • Lack of JavaScript support for various PDF objects.
  • XFA forms can only be created using Adobe LiveCycle Forms Designer.
  • Compatibility issues with AcroForms.
  • Lack of automatic conversion from AcroForms to XFA.
  • Accessibility is limited compared to AcroForms.
  • Developer skills are required to build tables.

Since AcroForms technology is considered more accessible and easy to use, this article will show how to programmatically perform PDF conversion from XFA to AcroForms in C# and Java using Aspose.PDF.

Recently, the .NET version of Aspose.PDF has been upgraded to v20.3, which supports tracking the progress of converting PDF to PowerPoint presentations, enhances the link extraction function, and fixes many bugs. Interested friends can click the button below to download the latest version.

.NET version of PDF processing control Aspose.PDF function demo: convert XFA to AcroForms in PDF

Convert XFA to AcroForms

Convert XFA to AcroForms in C#

Following are the steps to convert XFA form to AcroForm using Aspose.PDF for .NET.

  • Use the Document class to load PDF documents with XFA forms.
  • Set the Document.Form.Type property to FormType.Standard.
  • Save the new document using the Document.Save(string) method.

The following code sample converts an XFA form in PDF to AcroForms using C#.

// Load PDF with XFA forms
Document document = new Document("XFAFormPDF.pdf");

// Set the form fields type as standard AcroForms
document.Form.Type = FormType.Standard;

// Save the resultant PDF with AcroForms
document.Save("XFA-to-AcroForms.pdf");

Convert XFA to AcroForms in Java

Following are the steps to convert XFA to AcroForms using Aspose.PDF for Java.

  • Load a PDF with an XFA form using the Document class.
  • Set the form type to FormType.Standard.
  • Save the updated document using the Document.save(string) method.

The following code sample shows how to convert XFA to AcroForms using Java.

// Load PDF with XFA forms
Document doc = new Document("XFAFormsPDF.pdf");

// Set the form fields type as standard AcroForms
doc.getForm().setType(FormType.Standard);

// Save the resultant PDF with AcroForms
doc.save("XFA-to-AcroForms.PDF");

 

Guess you like

Origin blog.csdn.net/m0_67129275/article/details/131717817