Sub ExportXFDF(path As String, filename As String, xfdffilename As String)
Log($"PDF2XFDF"$)
Private box As PDFBox
box.Initialize("",File.Combine(path,filename))
Dim doc As PDDocument = box.Document
Dim cat As PDDocumentCatalog = doc.DocumentCatalog
Dim acroform As PDAcroForm = cat.AcroForm
Dim fdfdoc As FDFDocument = acroform.exportFDF
fdfdoc.saveXFDF(xfdffilename)
doc.close() ' Close PDF
fdfdoc.close
End Sub
Sub ImportXFDF(path As String, filename As String, xfdffilename As String, destinationpdfFilename As String)
Private box As PDFBox
box.Initialize("",File.Combine(path,filename))
Dim doc As PDDocument = box.Document
Dim cat As PDDocumentCatalog = doc.DocumentCatalog
Dim acroform As PDAcroForm = cat.AcroForm
Dim fdfdoc As FDFDocument = acroform.exportFDF
fdfdoc.loadXFDF(xfdffilename)
acroform.importFDF(fdfdoc)
fdfdoc.close
doc.save(destinationpdfFilename) ' Save PDF to Disc
doc.close() ' Close PDF
End Sub