B4J Question Read the value of a check box in a PDF File

Giacomo

Active Member
Licensed User
Longtime User
I have some PDF files from which I can easily extract any text (I use JPDFbox library)
Immagine.jpg


like this

But I can't read which of the two boxes is selected

I have tried using the JPDFJet library without getting any results.
is it possible to have some examples to use JPDFJet?

Thanks Happy New Year everyone
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
If the code in the link above does not contain them.

Here are two subs to Export and to Import a XFDF from/to a PDF.

B4X:
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
 
Upvote 0
Top