vendredi 15 février 2019

How can I get pdf checkbox value in Powershell using iTextsharp

I want to get the selected checkbox name in a PDF file. There are textbox and checkbox fields in the PDF and I'm using itextsharp.dll to parse it.

No issue for textbox. I have a "contract" field with multiple checkbox, one for each kind of contract, and the same code doesn't work, it returns a strange "Yes" value.

How can I get the selected checkbox name from the "Contract" field ?

Powershell :

Add-Type -Path ".\itextsharp.dll"
$PDF = New-Object iTextSharp.text.pdf.pdfreader -ArgumentList $PDFpath
$Name= $PDF.AcroFields.GetField("Name")
$Contract = $PDF.AcroFields.GetField("Contract")

$Name is ok but $Contract is "Yes" and not the selected checkbox name. Thank you and don't flame me for my poor english, ty.




Aucun commentaire:

Enregistrer un commentaire