本文整理匯總了C#中iTextSharp.text.pdf.PdfFormField.SetAppearance方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfFormField.SetAppearance方法的具體用法?C# PdfFormField.SetAppearance怎麽用?C# PdfFormField.SetAppearance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfFormField
的用法示例。
在下文中一共展示了PdfFormField.SetAppearance方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DrawRadioAppearences
virtual public void DrawRadioAppearences(PdfFormField field, string value, float llx, float lly, float urx, float ury) {
PdfAppearance tpOn = PdfAppearance.CreateAppearance(writer, urx - llx, ury - lly);
tpOn.DrawRadioField(0f, 0f, urx - llx, ury - lly, true);
field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, value, tpOn);
PdfAppearance tpOff = PdfAppearance.CreateAppearance(writer, urx - llx, ury - lly);
tpOff.DrawRadioField(0f, 0f, urx - llx, ury - lly, false);
field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
}
示例2: DrawSignatureAppearences
/**
* @param field
* @param llx
* @param lly
* @param urx
* @param ury
*/
virtual public void DrawSignatureAppearences(PdfFormField field, float llx, float lly, float urx, float ury) {
PdfAppearance tp = PdfAppearance.CreateAppearance(writer, urx - llx, ury - lly);
tp.SetGrayFill(1.0f);
tp.Rectangle(0, 0, urx - llx, ury - lly);
tp.Fill();
tp.SetGrayStroke(0);
tp.SetLineWidth(1);
tp.Rectangle(0.5f, 0.5f, urx - llx - 0.5f, ury - lly - 0.5f);
tp.ClosePathStroke();
tp.SaveState();
tp.Rectangle(1, 1, urx - llx - 2, ury - lly - 2);
tp.Clip();
tp.NewPath();
tp.RestoreState();
field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
}
示例3: DrawCheckBoxAppearences
virtual public void DrawCheckBoxAppearences(PdfFormField field, string value, float llx, float lly, float urx, float ury) {
BaseFont font = BaseFont.CreateFont(BaseFont.ZAPFDINGBATS, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
float size = (ury - lly);
PdfAppearance tpOn = PdfAppearance.CreateAppearance(writer, urx - llx, ury - lly);
PdfAppearance tp2 = (PdfAppearance)tpOn.Duplicate;
tp2.SetFontAndSize(font, size);
tp2.ResetRGBColorFill();
field.DefaultAppearanceString = tp2;
tpOn.DrawTextField(0f, 0f, urx - llx, ury - lly);
tpOn.SaveState();
tpOn.ResetRGBColorFill();
tpOn.BeginText();
tpOn.SetFontAndSize(font, size);
tpOn.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "4", (urx - llx) / 2, (ury - lly) / 2 - (size * 0.3f), 0);
tpOn.EndText();
tpOn.RestoreState();
field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, value, tpOn);
PdfAppearance tpOff = PdfAppearance.CreateAppearance(writer, urx - llx, ury - lly);
tpOff.DrawTextField(0f, 0f, urx - llx, ury - lly);
field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
}
示例4: DrawMultiLineOfText
virtual public void DrawMultiLineOfText(PdfFormField field, string text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
PdfAppearance tp = PdfAppearance.CreateAppearance(writer, urx - llx, ury - lly);
PdfAppearance tp2 = (PdfAppearance)tp.Duplicate;
tp2.SetFontAndSize(font, fontSize);
tp2.ResetRGBColorFill();
field.DefaultAppearanceString = tp2;
tp.DrawTextField(0f, 0f, urx - llx, ury - lly);
tp.BeginVariableText();
tp.SaveState();
tp.Rectangle(3f, 3f, urx - llx - 6f, ury - lly - 6f);
tp.Clip();
tp.NewPath();
tp.BeginText();
tp.SetFontAndSize(font, fontSize);
tp.ResetRGBColorFill();
tp.SetTextMatrix(4, 5);
System.util.StringTokenizer tokenizer = new System.util.StringTokenizer(text, "\n");
float yPos = ury - lly;
while (tokenizer.HasMoreTokens()) {
yPos -= fontSize * 1.2f;
tp.ShowTextAligned(PdfContentByte.ALIGN_LEFT, tokenizer.NextToken(), 3, yPos, 0);
}
tp.EndText();
tp.RestoreState();
tp.EndVariableText();
field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
}
示例5: DrawSingleLineOfText
virtual public void DrawSingleLineOfText(PdfFormField field, string text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
PdfAppearance tp = PdfAppearance.CreateAppearance(writer, urx - llx, ury - lly);
PdfAppearance tp2 = (PdfAppearance)tp.Duplicate;
tp2.SetFontAndSize(font, fontSize);
tp2.ResetRGBColorFill();
field.DefaultAppearanceString = tp2;
tp.DrawTextField(0f, 0f, urx - llx, ury - lly);
tp.BeginVariableText();
tp.SaveState();
tp.Rectangle(3f, 3f, urx - llx - 6f, ury - lly - 6f);
tp.Clip();
tp.NewPath();
tp.BeginText();
tp.SetFontAndSize(font, fontSize);
tp.ResetRGBColorFill();
tp.SetTextMatrix(4, (ury - lly) / 2 - (fontSize * 0.3f));
tp.ShowText(text);
tp.EndText();
tp.RestoreState();
tp.EndVariableText();
field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
}
示例6: DrawButton
virtual public void DrawButton(PdfFormField button, string caption, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
PdfAppearance pa = PdfAppearance.CreateAppearance(writer, urx - llx, ury - lly);
pa.DrawButton(0f, 0f, urx - llx, ury - lly, caption, font, fontSize);
button.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, pa);
}
示例7: AddMap
virtual public PdfFormField AddMap(string name, string value, string url, PdfContentByte appearance, float llx, float lly, float urx, float ury) {
PdfAction action = PdfAction.CreateSubmitForm(url, null, PdfAction.SUBMIT_HTML_FORMAT | PdfAction.SUBMIT_COORDINATES);
PdfFormField button = new PdfFormField(writer, llx, lly, urx, ury, action);
SetButtonParams(button, PdfFormField.FF_PUSHBUTTON, name, null);
PdfAppearance pa = PdfAppearance.CreateAppearance(writer, urx - llx, ury - lly);
pa.Add(appearance);
button.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, pa);
AddFormField(button);
return button;
}