PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.net/

Is it possible to get the type of an AcroField? e.g TextBox
http://forum.pdfsharp.net/viewtopic.php?f=2&t=3454
Page 1 of 1

Author:  RBrNx [ Mon Sep 12, 2016 10:45 am ]
Post subject:  Is it possible to get the type of an AcroField? e.g TextBox

I am writing a program to fill Text Fields in a PDF that's loaded from memory. The PDF features a number of Text Fields, but also has some other types of Fields such as Check Boxes and Combo Boxes.

I am currently just using
Code:
PdfTextField currField = (PdfTextField)inForm.Fields[elementName];
currField.Value = new PdfString(elementValue);


to set the value of each text box, however if one of the other Fields, e.g a checkbox is chosen, then I will obviously get a cast exception. So how can I check that the AcroField is a TextBox before I set it's value?

Thanks, RBrNx

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/