C# 용 iTextSharp 라이브러리를 사용하여 하나의 확인란 만 추가하려고합니다. 몇 가지 예를 살펴보고 수정하려고 시도 했으므로 그룹의 확인란을 만드는 방법을 보여줍니다. 하나만 만들려면 어떻게해야합니까?iTextSharp와 함께 하나의 확인란을 추가하십시오.
private static void WriteFooter(Document doc, int page, int maxPages, bool lastPage, PdfWriter writer, PdfAppearance[] checkBoxAppearance)
{
if(!lastPage)
{
doc.Add(new Paragraph("\nMA-2028.1-F2(Portrait) Page " + page + " of " + maxPages, Fonts.ExtraSmall));
doc.NewPage();
} else
{
PdfContentByte cb = writer.DirectContent;
PdfFormField _checkGroup = PdfFormField.CreateRadioButton(writer, true);
RadioCheckField _radioG;
PdfFormField _radioField1;
_radioG = new RadioCheckField(writer, new Rectangle(20, 20), null, "Yes");
_radioG.CheckType = RadioCheckField.TYPE_CHECK;
_radioField1 = _radioG.RadioField;
_checkGroup.AddKid(_radioField1);
ColumnText.ShowTextAligned(cb, Element.ALIGN_RIGHT, new Phrase("No Users Require Deletion"), 20, 20, 0);
writer.AddAnnotation(_checkGroup);
cb = writer.DirectContent;
doc.Add(
new Paragraph(
"Operations Management:\n\n", Fonts.Small) { Alignment = Element.ALIGN_CENTER });
doc.Add(
new Paragraph(
"Automation Manager or Designee: \n\n", Fonts.Small) { Alignment = Element.ALIGN_CENTER });
}
}
작성자 및 checkBoxAppearance는 다른 함수에서 전달됩니다. 이전에 코드에서 체크 박스가있는 테이블을 만들었지 만이 테이블 외부에 하나를 추가해야합니다. 나는 코드를 따랐다 http://simpledotnetsolutions.wordpress.com/2012/11/01/itextsharp-creating-form-fields/
checkboxAppearance는 체크 박스의 동작을 정의하는 배열이다.
그리고 하나의 체크 박스 만 수정하려고했습니다. 그 옆에 텍스트가 표시되도록하려고합니다.
편집 : 나는이를 시도하고있다 :
private static void WriteFooter(Document doc, int page, int maxPages, bool lastPage, PdfWriter writer, PdfFormField checkboxField, PdfAppearance[] checkbox, PdfContentByte cb)
{
if(!lastPage)
{
doc.Add(new Paragraph("\nMA-2028.1-F2(Portrait) Page " + page + " of " + maxPages, Fonts.ExtraSmall));
doc.NewPage();
} else
{
PdfFormField field;
RadioCheckField checkBox;
for (int i = 0; i < 1; i++)
{
checkBox = new RadioCheckField(writer, new Rectangle(20, 20), "noDelete", "Yes");
field = checkBox.CheckField;
field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", checkbox[0]);
field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Yes", checkbox[1]);
writer.AddAnnotation(field);
//ColumnText.ShowTextAligned(cb, Element.ALIGN_RIGHT, new Phrase("No Users Need Deletion"), 210, 790, 0);
}
doc.Add(
new Paragraph(
"Operations Management:\n\n", Fonts.Small) { Alignment = Element.ALIGN_CENTER });
doc.Add(
new Paragraph(
"Automation Manager or Designee:\n\n", Fonts.Small) { Alignment = Element.ALIGN_CENTER });
}
}
iTextSharp v5.5.11에서 작동하지 않는 것은 정말 수치스러운 일입니다. – CarneyCode