在c#asp.net web应用程序中使用ItextSharp检查条件时,如何在pdfpcell中隐藏复选框

在c#asp.net web应用程序中使用ItextSharp检查条件时,如何在pdfpcell中隐藏复选框,c#,asp.net,itextsharp,C#,Asp.net,Itextsharp,上下文:创建了复选框,并尝试使用cellEvent将复选框添加到pdfpcell。使用addElement方法将表包含复选框添加到父表pdfpcell。如何在满足某些条件时使用itextsharp使checkbox.checked=true,就像我们在asp.net中对checkbox控件所做的那样 PdfPTable fslchkbox = new PdfPTable(1); chkbox = new PdfPCell(); chkbox.HorizontalAli

上下文:创建了复选框,并尝试使用cellEvent将复选框添加到pdfpcell。使用addElement方法将表包含复选框添加到父表pdfpcell。如何在满足某些条件时使用itextsharp使checkbox.checked=true,就像我们在asp.net中对checkbox控件所做的那样

PdfPTable fslchkbox = new PdfPTable(1);
       chkbox = new PdfPCell();
       chkbox.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
       iTextSharp.text.pdf.events.FieldPositioningEvents fslevents = new iTextSharp.text.pdf.events.FieldPositioningEvents(writer, ck2);
       chkbox.CellEvent = fslevents;
       chkbox.Border = 0;
       fslchkbox.AddCell(chkbox);

       PdfPCell FSLChk = new PdfPCell();
       FSLChk.Border = 0;
       FSLChk.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
       FSLChk.AddElement(fslchkbox);
       program.AddCell(FSLChk);
       document.add(program);

如何创建复选框。这边PdfContentByte cb=writer.DirectContent;RadioCheckField chk=新的RadioCheckField(写入器,新矩形(5,5,1,1),“eslchk”,“p1”);chk.CheckType=RadioCheckField.TYPE\u CHECK;chk.Checked=真;chk.BorderWidth=BaseField.BORDER\u WIDTH\u THIN;chk.BorderColor=BaseColor.BLACK;chk.BackgroundColor=BaseColor.WHITE;chk.Options=RadioCheckField.READ_;Pdformfield ck=chk.CheckField;writer.AddAnnotation(ck);上面的代码是我在pdf文档中创建复选框的方式