本文整理汇总了C#中iTextSharp.text.pdf.PdfNumber类的典型用法代码示例。如果您正苦于以下问题:C# PdfNumber类的具体用法?C# PdfNumber怎么用?C# PdfNumber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PdfNumber类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PdfNumber类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddItem
/**
* Sets the value of the collection item.
* @param value
*/
public void AddItem(String key, PdfNumber n) {
PdfName fieldname = new PdfName(key);
PdfCollectionField field = (PdfCollectionField)schema.Get(fieldname);
if (field.fieldType == PdfCollectionField.NUMBER) {
Put(fieldname, n);
}
}
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:11,代码来源:PdfCollectionItem.cs
示例2: SetConversionFactor
/**
* The conversion factor used to multiply a value in partial units of the
* previous number format array element to obtain a value in the units of
* this dictionary. When this entry is in the first number format in the
* array, its meaning (that is, what it shall be multiplied by) depends on
* which entry in the RectilinearMeasure references the NumberFormat
* array.
*
* @param n
*/
virtual public void SetConversionFactor(PdfNumber n) {
base.Put(PdfName.C, n);
}
开发者ID:newlysoft,项目名称:itextsharp,代码行数:13,代码来源:NumberFormatDictionary.cs
示例3: SetPrecision
/**
* A positive integer that shall specify the precision or denominator of a
* fractional amount:
* <ul>
* <li>
* When the Fractional Value is {@link Fraction#DECIMAL}, this entry shall
* be the precision of a decimal display; it shall be a multiple of 10.
* Low-order zeros may be truncated unless FixedDenominator is true. Default
* value: 100 (hundredths, corresponding to two decimal digits).</li>
* <li>When the value of F is {@link Fraction#FRACTION}, this entry shall be
* the denominator of a fractional display. The fraction may be reduced
* unless the value of FD is true. Default value: 16.</li>
* </ul>
*
* @param precision
*/
virtual public void SetPrecision(PdfNumber precision) {
base.Put(PdfName.D, precision);
}
开发者ID:newlysoft,项目名称:itextsharp,代码行数:19,代码来源:NumberFormatDictionary.cs
示例4: SetFieldProperty
/**
* Sets a field property. Valid property names are:
* <p>
* <ul>
* <li>flags - a set of flags specifying various characteristics of the field�s widget annotation.
* The value of this entry replaces that of the F entry in the form�s corresponding annotation dictionary.<br>
* <li>setflags - a set of flags to be set (turned on) in the F entry of the form�s corresponding
* widget annotation dictionary. Bits equal to 1 cause the corresponding bits in F to be set to 1.<br>
* <li>clrflags - a set of flags to be cleared (turned off) in the F entry of the form�s corresponding
* widget annotation dictionary. Bits equal to 1 cause the corresponding
* bits in F to be set to 0.<br>
* <li>fflags - a set of flags specifying various characteristics of the field. The value
* of this entry replaces that of the Ff entry in the form�s corresponding field dictionary.<br>
* <li>setfflags - a set of flags to be set (turned on) in the Ff entry of the form�s corresponding
* field dictionary. Bits equal to 1 cause the corresponding bits in Ff to be set to 1.<br>
* <li>clrfflags - a set of flags to be cleared (turned off) in the Ff entry of the form�s corresponding
* field dictionary. Bits equal to 1 cause the corresponding bits in Ff
* to be set to 0.<br>
* </ul>
* @param field the field name
* @param name the property name
* @param value the property value
* @param inst an array of <CODE>int</CODE> indexing into <CODE>AcroField.Item.merged</CODE> elements to process.
* Set to <CODE>null</CODE> to process all
* @return <CODE>true</CODE> if the property exists, <CODE>false</CODE> otherwise
*/
public bool SetFieldProperty(String field, String name, int value, int[] inst)
{
if (writer == null)
throw new Exception("This AcroFields instance is read-only.");
Item item = (Item)fields[field];
if (item == null)
return false;
InstHit hit = new InstHit(inst);
if (Util.EqualsIgnoreCase(name, "flags")) {
PdfNumber num = new PdfNumber(value);
for (int k = 0; k < item.Size; ++k) {
if (hit.IsHit(k)) {
item.GetMerged(k).Put(PdfName.F, num);
item.GetWidget(k).Put(PdfName.F, num);
MarkUsed(item.GetWidget(k));
}
}
}
else if (Util.EqualsIgnoreCase(name, "setflags")) {
for (int k = 0; k < item.Size; ++k) {
if (hit.IsHit(k)) {
PdfNumber num = item.GetWidget(k).GetAsNumber(PdfName.F);
int val = 0;
if (num != null)
val = num.IntValue;
num = new PdfNumber(val | value);
item.GetMerged(k).Put(PdfName.F, num);
item.GetWidget(k).Put(PdfName.F, num);
MarkUsed(item.GetWidget(k));
}
}
}
else if (Util.EqualsIgnoreCase(name, "clrflags")) {
for (int k = 0; k < item.Size; ++k) {
if (hit.IsHit(k)) {
PdfDictionary widget = item.GetWidget( k );
PdfNumber num = widget.GetAsNumber(PdfName.F);
int val = 0;
if (num != null)
val = num.IntValue;
num = new PdfNumber(val & (~value));
item.GetMerged(k).Put(PdfName.F, num);
widget.Put(PdfName.F, num);
MarkUsed(widget);
}
}
}
else if (Util.EqualsIgnoreCase(name, "fflags")) {
PdfNumber num = new PdfNumber(value);
for (int k = 0; k < item.Size; ++k) {
if (hit.IsHit(k)) {
item.GetMerged(k).Put(PdfName.FF, num);
item.GetValue(k).Put(PdfName.FF, num);
MarkUsed(item.GetValue(k));
}
}
}
else if (Util.EqualsIgnoreCase(name, "setfflags")) {
for (int k = 0; k < item.Size; ++k) {
if (hit.IsHit(k)) {
PdfDictionary valDict = item.GetValue( k );
PdfNumber num = valDict.GetAsNumber( PdfName.FF );
int val = 0;
if (num != null)
val = num.IntValue;
num = new PdfNumber(val | value);
item.GetMerged(k).Put(PdfName.FF, num);
valDict.Put(PdfName.FF, num);
MarkUsed(valDict);
}
}
}
else if (Util.EqualsIgnoreCase(name, "clrfflags")) {
for (int k = 0; k < item.Size; ++k) {
//.........这里部分代码省略.........
开发者ID:JamieMellway,项目名称:iTextSharpLGPL-Monotouch,代码行数:101,代码来源:AcroFields.cs
示例5: SetField
/** Sets the field value and the display string. The display string
* is used to build the appearance in the cases where the value
* is modified by Acrobat with JavaScript and the algorithm is
* known.
* @param name the fully qualified field name or the partial name in the case of XFA forms
* @param value the field value
* @param display the string that is used for the appearance. If <CODE>null</CODE>
* the <CODE>value</CODE> parameter will be used
* @return <CODE>true</CODE> if the field was found and changed,
* <CODE>false</CODE> otherwise
* @throws IOException on error
* @throws DocumentException on error
*/
public bool SetField(String name, String value, String display)
{
if (writer == null)
throw new DocumentException("This AcroFields instance is read-only.");
if (xfa.XfaPresent) {
name = xfa.FindFieldName(name, this);
if (name == null)
return false;
String shortName = XfaForm.Xml2Som.GetShortName(name);
XmlNode xn = xfa.FindDatasetsNode(shortName);
if (xn == null) {
xn = xfa.DatasetsSom.InsertNode(xfa.DatasetsNode, shortName);
}
xfa.SetNodeText(xn, value);
}
Item item = (Item)fields[name];
if (item == null)
return false;
PdfDictionary merged = item.GetMerged( 0 );
PdfName type = merged.GetAsName(PdfName.FT);
if (PdfName.TX.Equals(type)) {
PdfNumber maxLen = merged.GetAsNumber(PdfName.MAXLEN);
int len = 0;
if (maxLen != null)
len = maxLen.IntValue;
if (len > 0)
value = value.Substring(0, Math.Min(len, value.Length));
}
if (display == null)
display = value;
if (PdfName.TX.Equals(type) || PdfName.CH.Equals(type)) {
PdfString v = new PdfString(value, PdfObject.TEXT_UNICODE);
for (int idx = 0; idx < item.Size; ++idx) {
PdfDictionary valueDic = item.GetValue(idx);
valueDic.Put(PdfName.V, v);
valueDic.Remove(PdfName.I);
MarkUsed(valueDic);
merged = item.GetMerged(idx);
merged.Remove(PdfName.I);
merged.Put(PdfName.V, v);
PdfDictionary widget = item.GetWidget(idx);
if (generateAppearances) {
PdfAppearance app = GetAppearance(merged, display, name);
if (PdfName.CH.Equals(type)) {
PdfNumber n = new PdfNumber(topFirst);
widget.Put(PdfName.TI, n);
merged.Put(PdfName.TI, n);
}
PdfDictionary appDic = widget.GetAsDict(PdfName.AP);
if (appDic == null) {
appDic = new PdfDictionary();
widget.Put(PdfName.AP, appDic);
merged.Put(PdfName.AP, appDic);
}
appDic.Put(PdfName.N, app.IndirectReference);
writer.ReleaseTemplate(app);
}
else {
widget.Remove(PdfName.AP);
merged.Remove(PdfName.AP);
}
MarkUsed(widget);
}
return true;
}
else if (PdfName.BTN.Equals(type)) {
PdfNumber ff = item.GetMerged(0).GetAsNumber(PdfName.FF);
int flags = 0;
if (ff != null)
flags = ff.IntValue;
if ((flags & PdfFormField.FF_PUSHBUTTON) != 0) {
//we'll assume that the value is an image in base64
Image img;
try {
img = Image.GetInstance(Convert.FromBase64String(value));
}
catch {
return false;
}
PushbuttonField pb = GetNewPushbuttonFromField(name);
pb.Image = img;
ReplacePushbuttonField(name, pb.Field);
return true;
}
PdfName v = new PdfName(value);
ArrayList lopt = new ArrayList();
PdfArray opts = item.GetValue(0).GetAsArray(PdfName.OPT);
//.........这里部分代码省略.........
开发者ID:JamieMellway,项目名称:iTextSharpLGPL-Monotouch,代码行数:101,代码来源:AcroFields.cs
示例6: SetFieldProperty
/**
* Sets a field property. Valid property names are:
* <p>
* <ul>
* <li>flags - a set of flags specifying various characteristics of the field’s widget annotation.
* The value of this entry replaces that of the F entry in the form’s corresponding annotation dictionary.<br>
* <li>setflags - a set of flags to be set (turned on) in the F entry of the form’s corresponding
* widget annotation dictionary. Bits equal to 1 cause the corresponding bits in F to be set to 1.<br>
* <li>clrflags - a set of flags to be cleared (turned off) in the F entry of the form’s corresponding
* widget annotation dictionary. Bits equal to 1 cause the corresponding
* bits in F to be set to 0.<br>
* <li>fflags - a set of flags specifying various characteristics of the field. The value
* of this entry replaces that of the Ff entry in the form’s corresponding field dictionary.<br>
* <li>setfflags - a set of flags to be set (turned on) in the Ff entry of the form’s corresponding
* field dictionary. Bits equal to 1 cause the corresponding bits in Ff to be set to 1.<br>
* <li>clrfflags - a set of flags to be cleared (turned off) in the Ff entry of the form’s corresponding
* field dictionary. Bits equal to 1 cause the corresponding bits in Ff
* to be set to 0.<br>
* </ul>
* @param field the field name
* @param name the property name
* @param value the property value
* @param inst an array of <CODE>int</CODE> indexing into <CODE>AcroField.Item.merged</CODE> elements to process.
* Set to <CODE>null</CODE> to process all
* @return <CODE>true</CODE> if the property exists, <CODE>false</CODE> otherwise
*/
public bool SetFieldProperty(String field, String name, int value, int[] inst)
{
if (writer == null)
throw new Exception("This AcroFields instance is read-only.");
Item item = (Item)fields[field];
if (item == null)
return false;
InstHit hit = new InstHit(inst);
if (Util.EqualsIgnoreCase(name, "flags")) {
PdfNumber num = new PdfNumber(value);
for (int k = 0; k < item.merged.Count; ++k) {
if (hit.IsHit(k)) {
((PdfDictionary)item.merged[k]).Put(PdfName.F, num);
((PdfDictionary)item.widgets[k]).Put(PdfName.F, num);
MarkUsed((PdfDictionary)item.widgets[k]);
}
}
}
else if (Util.EqualsIgnoreCase(name, "setflags")) {
for (int k = 0; k < item.merged.Count; ++k) {
if (hit.IsHit(k)) {
PdfNumber num = (PdfNumber)PdfReader.GetPdfObject(((PdfDictionary)item.widgets[k]).Get(PdfName.F));
int val = 0;
if (num != null)
val = num.IntValue;
num = new PdfNumber(val | value);
((PdfDictionary)item.merged[k]).Put(PdfName.F, num);
((PdfDictionary)item.widgets[k]).Put(PdfName.F, num);
MarkUsed((PdfDictionary)item.widgets[k]);
}
}
}
else if (Util.EqualsIgnoreCase(name, "clrflags")) {
for (int k = 0; k < item.merged.Count; ++k) {
if (hit.IsHit(k)) {
PdfNumber num = (PdfNumber)PdfReader.GetPdfObject(((PdfDictionary)item.widgets[k]).Get(PdfName.F));
int val = 0;
if (num != null)
val = num.IntValue;
num = new PdfNumber(val & (~value));
((PdfDictionary)item.merged[k]).Put(PdfName.F, num);
((PdfDictionary)item.widgets[k]).Put(PdfName.F, num);
MarkUsed((PdfDictionary)item.widgets[k]);
}
}
}
else if (Util.EqualsIgnoreCase(name, "fflags")) {
PdfNumber num = new PdfNumber(value);
for (int k = 0; k < item.merged.Count; ++k) {
if (hit.IsHit(k)) {
((PdfDictionary)item.merged[k]).Put(PdfName.FF, num);
((PdfDictionary)item.values[k]).Put(PdfName.FF, num);
MarkUsed((PdfDictionary)item.values[k]);
}
}
}
else if (Util.EqualsIgnoreCase(name, "setfflags")) {
for (int k = 0; k < item.merged.Count; ++k) {
if (hit.IsHit(k)) {
PdfNumber num = (PdfNumber)PdfReader.GetPdfObject(((PdfDictionary)item.values[k]).Get(PdfName.FF));
int val = 0;
if (num != null)
val = num.IntValue;
num = new PdfNumber(val | value);
((PdfDictionary)item.merged[k]).Put(PdfName.FF, num);
((PdfDictionary)item.values[k]).Put(PdfName.FF, num);
MarkUsed((PdfDictionary)item.values[k]);
}
}
}
else if (Util.EqualsIgnoreCase(name, "clrfflags")) {
for (int k = 0; k < item.merged.Count; ++k) {
if (hit.IsHit(k)) {
PdfNumber num = (PdfNumber)PdfReader.GetPdfObject(((PdfDictionary)item.values[k]).Get(PdfName.FF));
//.........这里部分代码省略.........
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:101,代码来源:AcroFields.cs
示例7: AdjustTabOrder
private void AdjustTabOrder(PdfArray annots, PdfIndirectReference ind, PdfNumber nn)
{
int v = nn.IntValue;
ArrayList t = (ArrayList)tabOrder[annots] ;
if (t == null) {
t = new ArrayList();
int size = annots.Size - 1;
for (int k = 0; k < size; ++k) {
t.Add(zero);
}
t.Add(v);
tabOrder[annots] = t;
annots.Add(ind);
}
else {
int size = t.Count - 1;
for (int k = size; k >= 0; --k) {
if ((int)t[k] <= v) {
t.Insert(k + 1, v);
annots.ArrayList.Insert(k + 1, ind);
size = -2;
break;
}
}
if (size != -2) {
t.Insert(0, v);
annots.ArrayList.Insert(0, ind);
}
}
}
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:30,代码来源:PdfCopyFieldsImp.cs
示例8: GetColorspace
PdfObject GetColorspace()
{
if (icc_profile != null) {
if ((colorType & 2) == 0)
return PdfName.DEVICEGRAY;
else
return PdfName.DEVICERGB;
}
if (gamma == 1f && !hasCHRM) {
if ((colorType & 2) == 0)
return PdfName.DEVICEGRAY;
else
return PdfName.DEVICERGB;
}
else {
PdfArray array = new PdfArray();
PdfDictionary dic = new PdfDictionary();
if ((colorType & 2) == 0) {
if (gamma == 1f)
return PdfName.DEVICEGRAY;
array.Add(PdfName.CALGRAY);
dic.Put(PdfName.GAMMA, new PdfNumber(gamma));
dic.Put(PdfName.WHITEPOINT, new PdfLiteral("[1 1 1]"));
array.Add(dic);
}
else {
PdfObject wp = new PdfLiteral("[1 1 1]");
array.Add(PdfName.CALRGB);
if (gamma != 1f) {
PdfArray gm = new PdfArray();
PdfNumber n = new PdfNumber(gamma);
gm.Add(n);
gm.Add(n);
gm.Add(n);
dic.Put(PdfName.GAMMA, gm);
}
if (hasCHRM) {
float z = yW*((xG-xB)*yR-(xR-xB)*yG+(xR-xG)*yB);
float YA = yR*((xG-xB)*yW-(xW-xB)*yG+(xW-xG)*yB)/z;
float XA = YA*xR/yR;
float ZA = YA*((1-xR)/yR-1);
float YB = -yG*((xR-xB)*yW-(xW-xB)*yR+(xW-xR)*yB)/z;
float XB = YB*xG/yG;
float ZB = YB*((1-xG)/yG-1);
float YC = yB*((xR-xG)*yW-(xW-xG)*yW+(xW-xR)*yG)/z;
float XC = YC*xB/yB;
float ZC = YC*((1-xB)/yB-1);
float XW = XA+XB+XC;
float YW = 1;//YA+YB+YC;
float ZW = ZA+ZB+ZC;
PdfArray wpa = new PdfArray();
wpa.Add(new PdfNumber(XW));
wpa.Add(new PdfNumber(YW));
wpa.Add(new PdfNumber(ZW));
wp = wpa;
PdfArray matrix = new PdfArray();
matrix.Add(new PdfNumber(XA));
matrix.Add(new PdfNumber(YA));
matrix.Add(new PdfNumber(ZA));
matrix.Add(new PdfNumber(XB));
matrix.Add(new PdfNumber(YB));
matrix.Add(new PdfNumber(ZB));
matrix.Add(new PdfNumber(XC));
matrix.Add(new PdfNumber(YC));
matrix.Add(new PdfNumber(ZC));
dic.Put(PdfName.MATRIX, matrix);
}
dic.Put(PdfName.WHITEPOINT, wp);
array.Add(dic);
}
return array;
}
}
开发者ID:jomamorales,项目名称:createPDF,代码行数:73,代码来源:PngImage.cs
示例9: CopyStructTreeForPage
public void CopyStructTreeForPage(PdfNumber sourceArrayNumber, int newArrayNumber)
{
if (!openedDocuments[fileName])
{
PdfObject res = writer.CopyObject(writer.CopyObject(structTreeRoot.Get(PdfName.K), true, true));
if (!(res is PdfIndirectReference))
res = writer.AddToBody(res).IndirectReference;
structureTreeRoot.AddPageMark(newArrayNumber, (PdfIndirectReference)res);
AddKid(structureTreeRoot, res);
openedDocuments.Add(fileName, true);
}
if (CopyPageMarks(parentTree, sourceArrayNumber, newArrayNumber) == returnType.NOTFOUND) {
throw new BadPdfFormatException(MessageLocalization.GetComposedMessage("structparent.not.found"));
}
}
开发者ID:mapo80,项目名称:iTextSharp-Monotouch,代码行数:15,代码来源:PdfStructTreeController.cs
示例10: RetrieveFontFromAcroForm
private Font RetrieveFontFromAcroForm(PdfName fontName, PdfNumber size) {
PdfIndirectReference fontIndirReference = pdfStamper.Reader.AcroForm.GetAsDict(PdfName.DR).GetAsDict(PdfName.FONT).GetAsIndirectObject(fontName);
BaseFont bfont = BaseFont.CreateFont((PRIndirectReference) fontIndirReference);
return new Font(bfont, size.FloatValue);
}
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:6,代码来源:PdfCleanUpProcessor.cs
示例11: DrawOverlayText
private void DrawOverlayText(PdfContentByte canvas, IList<Rectangle> textRectangles, PdfString overlayText,
PdfString otDA, PdfNumber otQ, PdfBoolean otRepeat) {
ColumnText ct = new ColumnText(canvas);
ct.SetLeading(0, 1.2F);
ct.UseAscender = true;
String otStr = overlayText.ToUnicodeString();
canvas.SaveState();
IDictionary<string, IList<object>> parsedDA = ParseDAParam(otDA);
Font font = null;
if (parsedDA.ContainsKey(STROKE_COLOR)) {
IList<object> strokeColorArgs = parsedDA[STROKE_COLOR];
SetStrokeColor(canvas, strokeColorArgs);
}
if (parsedDA.ContainsKey(FILL_COLOR)) {
IList<object> fillColorArgs = parsedDA[FILL_COLOR];
SetFillColor(canvas, fillColorArgs);
}
if (parsedDA.ContainsKey("Tf")) {
IList<object> tfArgs = parsedDA["Tf"];
font = RetrieveFontFromAcroForm((PdfName) tfArgs[0], (PdfNumber) tfArgs[1]);
}
foreach (Rectangle textRect in textRectangles) {
ct.SetSimpleColumn(textRect);
if (otQ != null) {
ct.Alignment = otQ.IntValue;
}
Phrase otPhrase;
if (font != null) {
otPhrase = new Phrase(otStr, font);
} else {
otPhrase = new Phrase(otStr);
}
float y = ct.YLine;
if (otRepeat != null && otRepeat.BooleanValue) {
int status = ct.Go(true);
while (!ColumnText.HasMoreText(status)) {
otPhrase.Add(otStr);
ct.SetText(otPhrase);
ct.YLine = y;
status = ct.Go(true);
}
}
ct.SetText(otPhrase);
ct.YLine = y;
ct.Go();
}
canvas.RestoreState();
}
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:63,代码来源:PdfCleanUpProcessor.cs
示例12: Add
/**
* Adds a <CODE>PdfNumber</CODE> to the <CODE>PdfArray</CODE>.
*
* @param number displacement of the string
*/
public void Add(PdfNumber number) {
Add((float)number.DoubleValue);
}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:8,代码来源:PdfTextArray.cs
示例13: LockPermissions
private LockPermissions(int p) {
number = new PdfNumber(p);
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:3,代码来源:PdfSigLockDictionary.cs
示例14: SetCYX
/**
* A factor that shall be used to convert the largest units along the y axis
* to the largest units along the x axis. It shall be used for calculations
* (distance, area, and angle) where the units are be equivalent; if not
* specified, these calculations may not be performed (which would be the
* case in situations such as x representing time and y representing
* temperature). Other calculations (change in x, change in y, and slope)
* shall not require this value.
*
* @param cyx
*/
public void SetCYX(PdfNumber cyx)
{
Put(PdfName.CYX, cyx);
}
开发者ID:boecko,项目名称:iTextSharp,代码行数:15,代码来源:MeasureRectilinear.cs
示例15: SetField
/** Sets the field value and the display string. The display string
* is used to build the appearance in the cases where the value
* is modified by Acrobat with JavaScript and the algorithm is
* known.
* @param name the fully qualified field name or the partial name in the case of XFA forms
* @param value the field value
* @param display the string that is used for the appearance. If <CODE>null</CODE>
* the <CODE>value</CODE> parameter will be used
* @return <CODE>true</CODE> if the field was found and changed,
* <CODE>false</CODE> otherwise
* @throws IOException on error
* @throws DocumentException on error
*/
public bool SetField(String name, String value, String display)
{
if (writer == null)
throw new DocumentException("This AcroFields instance is read-only.");
if (xfa.XfaPresent) {
name = xfa.FindFieldName(name, this);
if (name == null)
return false;
String shortName = XfaForm.Xml2Som.GetShortName(name);
xfa.SetNodeText(xfa.FindDatasetsNode(shortName), value);
}
Item item = (Item)fields[name];
if (item == null)
return false;
PdfName type = (PdfName)PdfReader.GetPdfObject(((PdfDictionary)item.merged[0]).Get(PdfName.FT));
if (PdfName.TX.Equals(type)) {
PdfNumber maxLen = (PdfNumber)PdfReader.GetPdfObject(((PdfDictionary)item.merged[0]).Get(PdfName.MAXLEN));
int len = 0;
if (maxLen != null)
len = maxLen.IntValue;
if (len > 0)
value = value.Substring(0, Math.Min(len, value.Length));
}
if (display == null)
display = value;
if (PdfName.TX.Equals(type) || PdfName.CH.Equals(type)) {
PdfString v = new PdfString(value, PdfObject.TEXT_UNICODE);
for (int idx = 0; idx < item.values.Count; ++idx) {
PdfDictionary valueDic = (PdfDictionary)item.values[idx];
valueDic.Put(PdfName.V, v);
valueDic.Remove(PdfName.I);
MarkUsed(valueDic);
PdfDictionary merged = (PdfDictionary)item.merged[idx];
merged.Remove(PdfName.I);
merged.Put(PdfName.V, v);
PdfDictionary widget = (PdfDictionary)item.widgets[idx];
if (generateAppearances) {
PdfAppearance app = GetAppearance(merged, display, name);
if (PdfName.CH.Equals(type)) {
PdfNumber n = new PdfNumber(topFirst);
widget.Put(PdfName.TI, n);
merged.Put(PdfName.TI, n);
}
PdfDictionary appDic = (PdfDictionary)PdfReader.GetPdfObject(widget.Get(PdfName.AP));
if (appDic == null) {
appDic = new PdfDictionary();
widget.Put(PdfName.AP, appDic);
merged.Put(PdfName.AP, appDic);
}
appDic.Put(PdfName.N, app.IndirectReference);
writer.ReleaseTemplate(app);
}
else {
widget.Remove(PdfName.AP);
merged.Remove(PdfName.AP);
}
MarkUsed(widget);
}
return true;
}
else if (PdfName.BTN.Equals(type)) {
PdfNumber ff = (PdfNumber)PdfReader.GetPdfObject(((PdfDictionary)item.merged[0]).Get(PdfName.FF));
int flags = 0;
if (ff != null)
flags = ff.IntValue;
if ((flags & PdfFormField.FF_PUSHBUTTON) != 0)
return true;
PdfName v = new PdfName(value);
if ((flags & PdfFormField.FF_RADIO) == 0) {
for (int idx = 0; idx < item.values.Count; ++idx) {
((PdfDictionary)item.values[idx]).Put(PdfName.V, v);
MarkUsed((PdfDictionary)item.values[idx]);
PdfDictionary merged = (PdfDictionary)item.merged[idx];
merged.Put(PdfName.V, v);
merged.Put(PdfName.AS, v);
PdfDictionary widget = (PdfDictionary)item.widgets[idx];
if (IsInAP(widget, v))
widget.Put(PdfName.AS, v);
else
widget.Put(PdfName.AS, PdfName.Off_);
MarkUsed(widget);
}
}
else {
ArrayList lopt = new ArrayList();
PdfObject opts = PdfReader.GetPdfObject(((PdfDictionary)item.values[0]).Get(PdfName.OPT));
if (opts != null && opts.IsArray()) {
//.........这里部分代码省略.........
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:101,代码来源:AcroFields.cs
示例16: AddXPTSValue
/**
* Adds a point to the Point Data dictionary.
* @param value an XPTS value
* @param identifier
*/
virtual public void AddXPTSValue(PdfNumber value, PtIdentifier identifier) {
xpts.Add(value);
names.Add(DecodeUnits.Decode(identifier));
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:9,代码来源:PointData.cs
示例17: Add
/**
* Adds a <CODE>PdfNumber</CODE> to the <CODE>PdfArray</CODE>.
*
* @param number displacement of the string
*/
public void Add(PdfNumber number)
{
arrayList.Add(number.DoubleValue);
}
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:9,代码来源:PdfTextArray.cs
注:本文中的iTextSharp.text.pdf.PdfNumber类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论