Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c# - Get the export value of a checkbox using iTextSharp -


i'm working on dynamically filling in fields on pdf document using itextsharp. i'd able determine "export value" of checkbox codebehind in order determine value send checkbox if should checked. of documents i've worked in past had same export value every check box 1 i'm working varies checkbox checkbox. go through of text boxes , make them consistent save lot of time in future if determine export value of these checkboxes @ runtime , set them accordingly.

thanks in advance!

i tried implement solution below in c# , ended following code:

 public string getcheckboxexportvalue(acrofields pdfdocument, string checkboxfieldname)     {         acrofields.item item = pdfdocument.getfielditem(checkboxfieldname);         if (item.values.count > 0)         {             pdfdictionary valuedict = item.getvalue(0);              pdfdictionary appearancedict = valuedict.getasdict(pdfname.ap);              // if there's appearance dict @ all, 1 key "off", , other             // export value... there should two.             if (appearancedict != null)             {                   foreach (pdfname curkey in appearancedict.keys)                 {                     if (!pdfname.off.equals(curkey))                     {                         return curkey.tostring(); // string have leading '/' character                     }                 }             }              // if doesn't work, there might /as key, value name              // export value, again leading '/'             pdfname curval = valuedict.getasname(pdfname.as);             if (curval != null)             {                 return curval.tostring();             }          }         //return null if far             return null;      } 

this returns "/d" every single time. i'm not sure if approach needs different in c# or if i'm missing something.

okay, need check low-level pdf objects appropriate values. can said values in pdf reference (chapter 12: interactive features, section 7: interactive forms).

in particular (and in java):

acrofields.item item = acrofields.getfielditem(fldname); pdfdictionary valuedict = item.getvalue(0);  pdfdictionary appearancedict = valuedict .getasdict(pdfname.ap);  if (appearancedict != null) {   pdfdictionary normalappearances = appearancedict.getasdict(pdfname.n);   // /d "down" appearances.    // if there normal appearances, 1 key "off", , other   // export value... there should two.   if (normalappearances != null) {     set<pdfname> keys = normalappearances .getkeys();     (pdfname curkey : keys) {       if (!pdfname.off.equals(curkey)) {         return curkey.tostring(); // string have leading '/' character       }     }   }   } // if doesn't work, there might /as key, value name  // export value, again leading '/' pdfname curval = valuedict.getasname(pdfname.as); if (curval != null) {   return curval.tostring(); } 

something that. usual "i wrote in edit box here" provisions apply, should go. write distressingly large amount of low level itext code.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -