diff --git a/Forms/ConvertXFAToAcroForms/.idea/runConfigurations/ConvertXFAToAcroForms.xml b/Forms/ConvertXFAToAcroForms/.idea/runConfigurations/ConvertXFAToAcroForms.xml
new file mode 100644
index 00000000..e582f6e3
--- /dev/null
+++ b/Forms/ConvertXFAToAcroForms/.idea/runConfigurations/ConvertXFAToAcroForms.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Forms/ConvertXFAToAcroForms/pom.xml b/Forms/ConvertXFAToAcroForms/pom.xml
new file mode 100644
index 00000000..0bb3bea2
--- /dev/null
+++ b/Forms/ConvertXFAToAcroForms/pom.xml
@@ -0,0 +1,190 @@
+
+
+ 4.0.0
+ com.datalogics.pdfl.samples
+ ConvertXFAToAcroForms
+ 1.0-SNAPSHOT
+
+ 1.8
+ 1.8
+
+
+
+ Windows64
+
+
+ windows
+ amd64
+
+
+
+ win-x86-64-jni
+
+
+
+ Linux64
+
+
+
+ Linux
+ amd64
+
+
+
+ linux-x86-64-jni
+
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ pom
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ zip
+ ${jni.classifier}
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ zip
+ resources
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ javadoc
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ pom
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ zip
+ ${jni.classifier}
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ javadoc
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.0.2
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ unpack-resources
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ resources
+ zip
+ ${project.build.directory}/lib/Resources
+
+
+
+
+
+ unpack-jni
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ ${jni.classifier}
+ zip
+ ${project.build.directory}/lib
+
+
+
+
+
+ unpack-forms-extension
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ forms-extension
+ ${jni.classifier}
+ zip
+ ${project.build.directory}/lib
+
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+
+ true
+ com.datalogics.pdfl.samples.ConvertXFAToAcroForms
+
+
+
+ jar-with-dependencies
+
+
+
+
+
+
diff --git a/Forms/ConvertXFAToAcroForms/src/main/java/com/datalogics/pdfl/samples/ConvertXFAToAcroForms.java b/Forms/ConvertXFAToAcroForms/src/main/java/com/datalogics/pdfl/samples/ConvertXFAToAcroForms.java
new file mode 100644
index 00000000..c3468e04
--- /dev/null
+++ b/Forms/ConvertXFAToAcroForms/src/main/java/com/datalogics/pdfl/samples/ConvertXFAToAcroForms.java
@@ -0,0 +1,59 @@
+package com.datalogics.pdfl.samples;
+
+/*
+ * Converts XFA (Dynamic or Static) fields to AcroForms fields and removes XFA fields.
+ *
+ * Copyright (c) 2007-2023, Datalogics, Inc. All rights reserved.
+ */
+import com.datalogics.PDFL.*;
+import java.util.EnumSet;
+public class ConvertXFAToAcroForms
+{
+
+ public static void main(String[] args) throws Throwable {
+ System.out.println("ConvertXFAToAcroForms sample:");
+
+ Library lib = new Library(EnumSet.of(LibraryFlags.INIT_FORMS_EXTENSION));
+
+ try
+ {
+ if (!lib.isFormsExtensionAvailable())
+ {
+ System.out.println("Forms Plugins were not properly loaded!");
+ return;
+ }
+
+ //Must be set to true to prevent default legacy behavior of PDFL
+ lib.setAllowOpeningXFA(true);
+
+ System.out.println("Initialized the library.");
+
+ //XFA document
+ String sInput = Library.getResourceDirectory() + "Sample_Input/DynamicXFA.pdf";
+ String sOutput = "../ConvertXFAToAcroForms-out.pdf";
+
+ if (args.length > 0)
+ {
+ sInput = args[0];
+ }
+
+ if (args.length > 1)
+ {
+ sOutput = args[1];
+ }
+
+ Document doc = new Document(sInput);
+ long pagesOutput = doc.convertXFAFieldsToAcroFormFields();
+
+ System.out.println("XFA document was converted into AcroForms document with " + pagesOutput + " pages.");
+
+ doc.save(EnumSet.of(SaveFlags.FULL, SaveFlags.LINEARIZED), sOutput);
+
+ doc.delete();
+ }
+ finally {
+ lib.delete();
+ }
+ }
+}
+
diff --git a/Forms/ExportFormsData/.idea/runConfigurations/ExportFormsData.xml b/Forms/ExportFormsData/.idea/runConfigurations/ExportFormsData.xml
new file mode 100644
index 00000000..41fe54a2
--- /dev/null
+++ b/Forms/ExportFormsData/.idea/runConfigurations/ExportFormsData.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Forms/ExportFormsData/pom.xml b/Forms/ExportFormsData/pom.xml
new file mode 100644
index 00000000..39e665f1
--- /dev/null
+++ b/Forms/ExportFormsData/pom.xml
@@ -0,0 +1,190 @@
+
+
+ 4.0.0
+ com.datalogics.pdfl.samples
+ ExportFormsData
+ 1.0-SNAPSHOT
+
+ 1.8
+ 1.8
+
+
+
+ Windows64
+
+
+ windows
+ amd64
+
+
+
+ win-x86-64-jni
+
+
+
+ Linux64
+
+
+
+ Linux
+ amd64
+
+
+
+ linux-x86-64-jni
+
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ pom
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ zip
+ ${jni.classifier}
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ zip
+ resources
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ javadoc
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ pom
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ zip
+ ${jni.classifier}
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ javadoc
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.0.2
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ unpack-resources
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ resources
+ zip
+ ${project.build.directory}/lib/Resources
+
+
+
+
+
+ unpack-jni
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ ${jni.classifier}
+ zip
+ ${project.build.directory}/lib
+
+
+
+
+
+ unpack-forms-extension
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ forms-extension
+ ${jni.classifier}
+ zip
+ ${project.build.directory}/lib
+
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+
+ true
+ com.datalogics.pdfl.samples.ExportFormsData
+
+
+
+ jar-with-dependencies
+
+
+
+
+
+
diff --git a/Forms/ExportFormsData/src/main/java/com/datalogics/pdfl/samples/ExportFormsData.java b/Forms/ExportFormsData/src/main/java/com/datalogics/pdfl/samples/ExportFormsData.java
new file mode 100644
index 00000000..442759bc
--- /dev/null
+++ b/Forms/ExportFormsData/src/main/java/com/datalogics/pdfl/samples/ExportFormsData.java
@@ -0,0 +1,88 @@
+
+package com.datalogics.pdfl.samples;
+
+/*
+ * The ExportFormsData sample demonstrates how to Export forms data from XFA and AcroForms documents:
+ *
+ * - Export data from a XFA (Dynamic or Static) document, the types supported include XDP, XML, or XFD
+ * - Export data from an AcroForms document, the types supported include XFDF, FDF, or XML
+ */
+import com.datalogics.PDFL.*;
+import java.util.EnumSet;
+public class ExportFormsData
+{
+
+ public static void main(String[] args) throws Throwable {
+ System.out.println("ExportFormsData sample:");
+
+ Library lib = new Library(EnumSet.of(LibraryFlags.INIT_FORMS_EXTENSION));
+
+ try
+ {
+ if (!lib.isFormsExtensionAvailable())
+ {
+ System.out.println("Forms Plugins were not properly loaded!");
+ return;
+ }
+
+ //Must be set to true to prevent default legacy behavior of PDFL
+ lib.setAllowOpeningXFA(true);
+
+ System.out.println("Initialized the library.");
+
+ //XFA document
+ String sInput = Library.getResourceDirectory() + "Sample_Input/DynamicXFA.pdf";
+ String sOutput = "../ExportFormsDataXFA.xdp";
+
+ if (args.length > 0)
+ {
+ sOutput = args[0];
+ }
+
+ Document doc = new Document(sInput);
+
+ //Export the data while specifying the type, in this case XDP
+ boolean result = doc.exportXFAFormsData(sOutput, XFAFormExportType.XDP);
+
+ if (result)
+ {
+ System.out.println("Forms data was exported!");
+ }
+ else
+ {
+ System.out.println("Exporting of Forms data failed!");
+ }
+
+ doc.delete();
+
+ //AcroForms document
+ sInput = Library.getResourceDirectory() + "Sample_Input/AcroForm.pdf";
+ sOutput = "../ExportFormsDataAcroForms.xfdf";
+
+ if (args.length > 1)
+ {
+ sOutput = args[1];
+ }
+
+ doc = new Document(sInput);
+
+ //Export the data while specifying the type, in this case XFDF
+ result = doc.exportAcroFormsData(sOutput, AcroFormExportType.XFDF);
+
+ if (result)
+ {
+ System.out.println("Forms data was exported!");
+ }
+ else
+ {
+ System.out.println("Exporting of Forms data failed!");
+ }
+
+ doc.delete();
+ }
+ finally {
+ lib.delete();
+ }
+ }
+}
+
diff --git a/Forms/FlattenForms/.idea/runConfigurations/FlattenForms.xml b/Forms/FlattenForms/.idea/runConfigurations/FlattenForms.xml
new file mode 100644
index 00000000..268218b4
--- /dev/null
+++ b/Forms/FlattenForms/.idea/runConfigurations/FlattenForms.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Forms/FlattenForms/pom.xml b/Forms/FlattenForms/pom.xml
new file mode 100644
index 00000000..bf07ff54
--- /dev/null
+++ b/Forms/FlattenForms/pom.xml
@@ -0,0 +1,190 @@
+
+
+ 4.0.0
+ com.datalogics.pdfl.samples
+ FlattenForms
+ 1.0-SNAPSHOT
+
+ 1.8
+ 1.8
+
+
+
+ Windows64
+
+
+ windows
+ amd64
+
+
+
+ win-x86-64-jni
+
+
+
+ Linux64
+
+
+
+ Linux
+ amd64
+
+
+
+ linux-x86-64-jni
+
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ pom
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ zip
+ ${jni.classifier}
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ zip
+ resources
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ javadoc
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ pom
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ zip
+ ${jni.classifier}
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ javadoc
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.0.2
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ unpack-resources
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ resources
+ zip
+ ${project.build.directory}/lib/Resources
+
+
+
+
+
+ unpack-jni
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ ${jni.classifier}
+ zip
+ ${project.build.directory}/lib
+
+
+
+
+
+ unpack-forms-extension
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ forms-extension
+ ${jni.classifier}
+ zip
+ ${project.build.directory}/lib
+
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+
+ true
+ com.datalogics.pdfl.samples.FlattenForms
+
+
+
+ jar-with-dependencies
+
+
+
+
+
+
diff --git a/Forms/FlattenForms/src/main/java/com/datalogics/pdfl/samples/FlattenForms.java b/Forms/FlattenForms/src/main/java/com/datalogics/pdfl/samples/FlattenForms.java
new file mode 100644
index 00000000..22429a3e
--- /dev/null
+++ b/Forms/FlattenForms/src/main/java/com/datalogics/pdfl/samples/FlattenForms.java
@@ -0,0 +1,76 @@
+
+package com.datalogics.pdfl.samples;
+
+/*
+ *
+ * The FlattenForms sample demonstrates how to Flatten XFA into AcroForms.
+ *
+ * - Flatten XFA (Dynamic or Static) to regular page content which converts and expands XFA fields to regular PDF content and removes the XFA fields.
+ * - Flatten AcroForms to regular page content which converts AcroForm fields to regular page content and removes the AcroForm fields.
+ *
+ * Copyright (c) 2024, Datalogics, Inc. All rights reserved.
+ */
+import com.datalogics.PDFL.*;
+import java.util.EnumSet;
+public class FlattenForms
+{
+
+ public static void main(String[] args) throws Throwable {
+ System.out.println("FlattenForms sample:");
+
+ Library lib = new Library(EnumSet.of(LibraryFlags.INIT_FORMS_EXTENSION));
+
+ try
+ {
+ if (!lib.isFormsExtensionAvailable())
+ {
+ System.out.println("Forms Plugins were not properly loaded!");
+ return;
+ }
+
+ //Must be set to true to prevent default legacy behavior of PDFL
+ lib.setAllowOpeningXFA(true);
+
+ System.out.println("Initialized the library.");
+
+ //XFA document
+ String sInput = Library.getResourceDirectory() + "Sample_Input/DynamicXFA.pdf";
+ String sOutput = "../FlattenXFA-out.pdf";
+
+ if (args.length > 0)
+ {
+ sInput = args[0];
+ }
+
+ if (args.length > 1)
+ {
+ sOutput = args[1];
+ }
+
+ Document doc = new Document(sInput);
+ long pagesOutput = doc.flattenXFAFormFields();
+
+ System.out.println("XFA document was expanded into " + pagesOutput + " Flattened pages.");
+
+ doc.save(EnumSet.of(SaveFlags.FULL, SaveFlags.LINEARIZED), sOutput);
+
+ doc.delete();
+
+ //AcroForms document
+ sInput = Library.getResourceDirectory() + "Sample_Input/AcroForm.pdf";
+ sOutput = "../FlattenAcroForms-out.pdf";
+
+ doc = new Document(sInput);
+
+ doc.flattenAcroFormFields();
+
+ System.out.println("AcroForms document was Flattened.");
+
+ doc.save(EnumSet.of(SaveFlags.FULL, SaveFlags.LINEARIZED), sOutput);
+ }
+ finally {
+ lib.delete();
+ }
+ }
+}
+
diff --git a/Forms/ImportFormsData/.idea/runConfigurations/ImportFormsData.xml b/Forms/ImportFormsData/.idea/runConfigurations/ImportFormsData.xml
new file mode 100644
index 00000000..6fa2144d
--- /dev/null
+++ b/Forms/ImportFormsData/.idea/runConfigurations/ImportFormsData.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Forms/ImportFormsData/pom.xml b/Forms/ImportFormsData/pom.xml
new file mode 100644
index 00000000..d27b8044
--- /dev/null
+++ b/Forms/ImportFormsData/pom.xml
@@ -0,0 +1,190 @@
+
+
+ 4.0.0
+ com.datalogics.pdfl.samples
+ ImportFormsData
+ 1.0-SNAPSHOT
+
+ 1.8
+ 1.8
+
+
+
+ Windows64
+
+
+ windows
+ amd64
+
+
+
+ win-x86-64-jni
+
+
+
+ Linux64
+
+
+
+ Linux
+ amd64
+
+
+
+ linux-x86-64-jni
+
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ pom
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ zip
+ ${jni.classifier}
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ zip
+ resources
+
+
+ com.datalogics.pdfl
+ pdfl
+ 18.36.0
+ javadoc
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ pom
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ zip
+ ${jni.classifier}
+
+
+ com.datalogics.pdfl
+ forms-extension
+ 18.37.0
+ javadoc
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.0.2
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ unpack-resources
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ resources
+ zip
+ ${project.build.directory}/lib/Resources
+
+
+
+
+
+ unpack-jni
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ pdfl
+ ${jni.classifier}
+ zip
+ ${project.build.directory}/lib
+
+
+
+
+
+ unpack-forms-extension
+ generate-resources
+
+ unpack
+
+
+
+
+ com.datalogics.pdfl
+ forms-extension
+ ${jni.classifier}
+ zip
+ ${project.build.directory}/lib
+
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+
+ true
+ com.datalogics.pdfl.samples.ImportFormsData
+
+
+
+ jar-with-dependencies
+
+
+
+
+
+
diff --git a/Forms/ImportFormsData/src/main/java/com/datalogics/pdfl/samples/ImportFormsData.java b/Forms/ImportFormsData/src/main/java/com/datalogics/pdfl/samples/ImportFormsData.java
new file mode 100644
index 00000000..22f99700
--- /dev/null
+++ b/Forms/ImportFormsData/src/main/java/com/datalogics/pdfl/samples/ImportFormsData.java
@@ -0,0 +1,98 @@
+
+package com.datalogics.pdfl.samples;
+
+/*
+ *
+ * The ImportFormsData sample demonstrates how to Import forms data into XFA and AcroForms documents:
+ *
+ * - Import data into a XFA (Dynamic or Static) document, the types supported include XDP, XML, or XFD
+ * - Import data into an AcroForms document, the types supported include XFDF, FDF, or XML
+ *
+ * Copyright (c) 2024, Datalogics, Inc. All rights reserved.
+
+ */
+import com.datalogics.PDFL.*;
+import java.util.EnumSet;
+public class ImportFormsData
+{
+
+ public static void main(String[] args) throws Throwable {
+ System.out.println("ImportFormsData sample:");
+
+ Library lib = new Library(EnumSet.of(LibraryFlags.INIT_FORMS_EXTENSION));
+
+ try
+ {
+ if (!lib.isFormsExtensionAvailable())
+ {
+ System.out.println("Forms Plugins were not properly loaded!");
+ return;
+ }
+
+ //Must be set to true to prevent default legacy behavior of PDFL
+ lib.setAllowOpeningXFA(true);
+
+ System.out.println("Initialized the library.");
+
+ //XFA document
+ String sInput = Library.getResourceDirectory() + "Sample_Input/DynamicXFA.pdf";
+ String sInputData = Library.getResourceDirectory() + "Sample_Input/DynamicXFA_data.xdp";
+ String sOutput = "../ImportFormsDataXFA-out.pdf";
+
+ if (args.length > 0)
+ {
+ sOutput = args[0];
+ }
+
+ Document doc = new Document(sInput);
+
+ //Import the data, acceptable types include XDP, XML, and XFD
+ boolean result = doc.importXFAFormsData(sInputData);
+
+ if (result)
+ {
+ System.out.println("Forms data was imported!");
+
+ doc.save(EnumSet.of(SaveFlags.FULL, SaveFlags.LINEARIZED), sOutput);
+ }
+ else
+ {
+ System.out.println("Importing of Forms data failed!");
+ }
+
+ doc.delete();
+
+ //AcroForms document
+ sInput = Library.getResourceDirectory() + "Sample_Input/AcroForm.pdf";
+ sInputData = Library.getResourceDirectory() + "Sample_Input/AcroForm_data.xfdf";
+ sOutput = "../ImportFormsDataAcroForms.xfdf";
+
+ if (args.length > 1)
+ {
+ sOutput = args[1];
+ }
+
+ doc = new Document(sInput);
+
+ //Import the data while specifying the type, in this case XFDF
+ result = doc.importAcroFormsData(sInputData, AcroFormImportType.XFDF);
+
+ if (result)
+ {
+ System.out.println("Forms data was imported!");
+
+ doc.save(EnumSet.of(SaveFlags.FULL, SaveFlags.LINEARIZED), sOutput);
+ }
+ else
+ {
+ System.out.println("Importing of Forms data failed!");
+ }
+
+ doc.delete();
+ }
+ finally {
+ lib.delete();
+ }
+ }
+}
+