Created
August 16, 2023 19:04
-
-
Save adatta02/bca6036962906680dbdcae2bbfe12068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using TallComponents.PDF; | |
using TallComponents.PDF.Forms.Fields; | |
using TallComponents.PDF.JavaScript; | |
Console.WriteLine(System.IO.Directory.GetCurrentDirectory()); | |
using (FileStream inFile = new FileStream(@"./nIVD_eSTAR_40.pdf", FileMode.Open, FileAccess.Read)) | |
{ | |
Document document = new Document(inFile); | |
document.Fields.Changed += Fields_Changed; | |
Console.WriteLine("Before we click the button!"); | |
for (int i = 0; i < document.Fields.Count; i++) | |
{ | |
Console.WriteLine("\t" + document.Fields[i].FullName); | |
} | |
RadioButtonField radioField = document.Fields["root[0].ApplicationType[0].USA[0].ATRadioButton110[0]"] as RadioButtonField; | |
radioField.Value = "1"; | |
// radioField.CalculateAction.JavaScript.Run(document); | |
Console.WriteLine("After we click the button!"); | |
for (int i = 0; i < document.Fields.Count; i++) | |
{ | |
Console.WriteLine("\t" + document.Fields[i].FullName); | |
} | |
using (FileStream outFile = new FileStream(@"./nIVD_eSTAR_40-filled.pdf", FileMode.Create, FileAccess.Write)) | |
{ | |
document.Write(outFile); | |
} | |
} | |
Console.WriteLine("All done!"); | |
static void Fields_Changed(FieldCollection sender, FieldsChangedEventArgs e) | |
{ | |
Console.WriteLine(e.Added.Length); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment