• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# pdf.PdfString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中iTextSharp.text.pdf.PdfString的典型用法代码示例。如果您正苦于以下问题:C# PdfString类的具体用法?C# PdfString怎么用?C# PdfString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PdfString类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PdfString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ParseDAParam

        IDictionary<string, IList<object>> ParseDAParam(PdfString DA) {
            IDictionary<string, IList<object>> commandArguments = new Dictionary<string, IList<object>>();

            PRTokeniser tokeniser = new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().CreateSource(DA.GetBytes())));
            IList<object> currentArguments = new List<object>();

            while (tokeniser.NextToken()) {
                if (tokeniser.TokenType == PRTokeniser.TokType.OTHER) {
                    String key = tokeniser.StringValue;

                    if (key == "RG" || key == "G" || key == "K") {
                        key = STROKE_COLOR;
                    } else if (key == "rg" || key == "g" || key == "k") {
                        key = FILL_COLOR;
                    }

                    if (commandArguments.ContainsKey(key)) {
                        commandArguments[key] = currentArguments;
                    } else {
                        commandArguments.Add(key, currentArguments);
                    }

                    currentArguments = new List<object>();
                } else {
                    switch (tokeniser.TokenType) {
                        case PRTokeniser.TokType.NUMBER:
                            currentArguments.Add(new PdfNumber(tokeniser.StringValue));
                            break;

                        case PRTokeniser.TokType.NAME:
                            currentArguments.Add(new PdfName(tokeniser.StringValue));
                            break;

                        default:
                            currentArguments.Add(tokeniser.StringValue);
                            break;
                    }
                }
            }

            return commandArguments;
        }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:42,代码来源:PdfCleanUpProcessor.cs


示例2: AddItem

 /**
 * Sets the value of the collection item.
 * @param value
 */
 virtual public void AddItem(String key, PdfString value) {
     PdfName fieldname = new PdfName(key);
     PdfCollectionField field = (PdfCollectionField)schema.Get(fieldname);
     if (field.fieldType == PdfCollectionField.TEXT) {
         Put(fieldname, value);
     }
 }
开发者ID:joshaxey,项目名称:Simple-PDFMerge,代码行数:11,代码来源:PdfCollectionItem.cs


示例3: AddRange

 internal void AddRange(PdfString from, PdfString to, PdfObject code) {
     byte[] a1 = DecodeStringToByte(from);
     byte[] a2 = DecodeStringToByte(to);
     if (a1.Length != a2.Length || a1.Length == 0)
         throw new ArgumentException("Invalid map.");
     byte[] sout = null;
     if (code is PdfString)
         sout = DecodeStringToByte((PdfString)code);
     int start = a1[a1.Length - 1] & 0xff;
     int end = a2[a2.Length - 1] & 0xff;
     for (int k = start; k <= end; ++k) {
         a1[a1.Length - 1] = (byte)k;
         PdfString s = new PdfString(a1);
         s.SetHexWriting(true);
         if (code is PdfArray) {
             AddChar(s, ((PdfArray)code)[k - start]);
         }
         else if (code is PdfNumber) {
             int nn = ((PdfNumber)code).IntValue + k - start;
             AddChar(s, new PdfNumber(nn));
         }
         else if (code is PdfString) {
             PdfString s1 = new PdfString(sout);
             s1.SetHexWriting(true);
             ++sout[sout.Length - 1];
             AddChar(s, s1);
         }
     }
 }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:29,代码来源:AbstractCMap.cs


示例4: AddChar

 internal override void AddChar(PdfString mark, PdfObject code) {
     if (!(code is PdfNumber))
         return;
     int codepoint;
     String s = DecodeStringToUnicode(mark);
     if (Utilities.IsSurrogatePair(s, 0))
         codepoint = Utilities.ConvertToUtf32(s, 0);
     else
         codepoint = (int)s[0];
     map[((PdfNumber)code).IntValue] = codepoint;
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:11,代码来源:CMapCidUni.cs


示例5: stringObjects

 virtual public void stringObjects()
 {
     byte[] bytes = new byte[256];
     for (int i = 0; i < 256; i++)
         bytes[i] = (byte) i;
     PdfString str = new PdfString(bytes);
     MemoryStream baos = new MemoryStream();
     str.SetHexWriting(true);
     str.ToPdf(null, baos);
     String s = Encoding.UTF8.GetString(baos.ToArray());
     Assert.AreEqual(514, s.Length);
 }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:12,代码来源:PdfAFileStructureTest.cs


示例6: AddChar

 internal override void AddChar(PdfString mark, PdfObject code)
 {
     byte[] src = mark.GetBytes();
     String dest = CreateStringFromBytes(code.GetBytes());
     if (src.Length == 1) {
         singleByteMappings[src[0] & 0xff] = dest;
     } else if (src.Length == 2) {
         int intSrc = src[0] & 0xFF;
         intSrc <<= 8;
         intSrc |= src[1] & 0xFF;
         doubleByteMappings[intSrc] = dest;
     } else {
         throw new IOException(MessageLocalization.GetComposedMessage("mapping.code.should.be.1.or.two.bytes.and.not.1", src.Length));
     }
 }
开发者ID:jomamorales,项目名称:createPDF,代码行数:15,代码来源:CMapToUnicode.cs


示例7: PdfOutline

 /**
  * Constructs a <CODE>PdfOutline</CODE>.
  * <P>
  * This is the constructor for an <CODE>outline entry</CODE>. The open mode is
  * <CODE>true</CODE>.
  *
  * @param parent the parent of this outline item
  * @param destination the destination for this outline item
  * @param title the title of this outline item
  */
 public PdfOutline(PdfOutline parent, PdfDestination destination, PdfString title)
     : this(parent, destination, title, true)
 {
 }
开发者ID:medvedttn,项目名称:itextsharp_mod-src,代码行数:14,代码来源:PdfOutline.cs


示例8: Close

 /**
 * Closes the document. No more content can be written after the
 * document is closed.
 * <p>
 * If closing a signed document with an external signature the closing must be done
 * in the <CODE>PdfSignatureAppearance</CODE> instance.
 * @throws DocumentException on error
 * @throws IOException on error
 */
 public void Close() {
     if (!hasSignature) {
         stamper.Close(moreInfo);
         return;
     }
     sigApp.PreClose();
     PdfSigGenericPKCS sig = sigApp.SigStandard;
     PdfLiteral lit = (PdfLiteral)sig.Get(PdfName.CONTENTS);
     int totalBuf = (lit.PosLength - 2) / 2;
     byte[] buf = new byte[8192];
     int n;
     Stream inp = sigApp.RangeStream;
     while ((n = inp.Read(buf, 0, buf.Length)) > 0) {
         sig.Signer.Update(buf, 0, n);
     }
     buf = new byte[totalBuf];
     byte[] bsig = sig.SignerContents;
     Array.Copy(bsig, 0, buf, 0, bsig.Length);
     PdfString str = new PdfString(buf);
     str.SetHexWriting(true);
     PdfDictionary dic = new PdfDictionary();
     dic.Put(PdfName.CONTENTS, str);
     sigApp.Close(dic);
     stamper.reader.Close();
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:34,代码来源:PdfStamper.cs


示例9: ReadPRObject

 /**
 * Reads a pdf object.
 * @return the pdf object
 * @throws IOException on error
 */
 public PdfObject ReadPRObject()
 {
     if (!NextValidToken())
         return null;
     PRTokeniser.TokType type = tokeniser.TokenType;
     switch (type) {
         case PRTokeniser.TokType.START_DIC: {
             PdfDictionary dic = ReadDictionary();
             return dic;
         }
         case PRTokeniser.TokType.START_ARRAY:
             return ReadArray();
         case PRTokeniser.TokType.STRING:
             PdfString str = new PdfString(tokeniser.StringValue, null).SetHexWriting(tokeniser.IsHexString());
             return str;
         case PRTokeniser.TokType.NAME:
             return new PdfName(tokeniser.StringValue, false);
         case PRTokeniser.TokType.NUMBER:
             return new PdfNumber(tokeniser.StringValue);
          case PRTokeniser.TokType.OTHER:
             return new PdfLiteral(COMMAND_TYPE, tokeniser.StringValue);
         default:
             return new PdfLiteral(-(int)type, tokeniser.StringValue);
     }
 }
开发者ID:jomamorales,项目名称:createPDF,代码行数:30,代码来源:PdfContentParser.cs


示例10: RenameField

 /**
 * Renames a field. Only the last part of the name can be renamed. For example,
 * if the original field is "ab.cd.ef" only the "ef" part can be renamed.
 * @param oldName the old field name
 * @param newName the new field name
 * @return <CODE>true</CODE> if the renaming was successful, <CODE>false</CODE>
 * otherwise
 */
 public bool RenameField(String oldName, String newName)
 {
     int idx1 = oldName.LastIndexOf('.') + 1;
     int idx2 = newName.LastIndexOf('.') + 1;
     if (idx1 != idx2)
         return false;
     if (!oldName.Substring(0, idx1).Equals(newName.Substring(0, idx2)))
         return false;
     if (fields.ContainsKey(newName))
         return false;
     Item item = (Item)fields[oldName];
     if (item == null)
         return false;
     newName = newName.Substring(idx2);
     PdfString ss = new PdfString(newName, PdfObject.TEXT_UNICODE);
     item.WriteToAll( PdfName.T, ss, Item.WRITE_VALUE | Item.WRITE_MERGED);
     item.MarkUsed( this, Item.WRITE_VALUE );
     fields.Remove(oldName);
     fields[newName] = item;
     return true;
 }
开发者ID:JamieMellway,项目名称:iTextSharpLGPL-Monotouch,代码行数:29,代码来源:AcroFields.cs


示例11: ReadPRObject

        virtual protected internal PdfObject ReadPRObject() {
            tokens.NextValidToken();
            PRTokeniser.TokType type = tokens.TokenType;
            switch (type) {
                case PRTokeniser.TokType.START_DIC: {
                    ++readDepth;
                    PdfDictionary dic = ReadDictionary();
                    --readDepth;
					long pos = tokens.FilePointer;
                    // be careful in the trailer. May not be a "next" token.
                    bool hasNext;
                    do {
                        hasNext = tokens.NextToken();
                    } while (hasNext && tokens.TokenType == PRTokeniser.TokType.COMMENT);

                    if (hasNext && tokens.StringValue.Equals("stream")) {
                        //skip whitespaces
                        int ch;
                        do {
                            ch = tokens.Read();                        
                        } while (ch == 32 || ch == 9 || ch == 0 || ch == 12);
                        if (ch != '\n')
                            ch = tokens.Read();
                        if (ch != '\n')
                            tokens.BackOnePosition(ch);
                        PRStream stream = new PRStream(this, tokens.FilePointer);
                        stream.Merge(dic);
                        stream.ObjNum = objNum;
                        stream.ObjGen = objGen;
                        return stream;
                    }
                    else {
                        tokens.Seek(pos);
                        return dic;
                    }
                }
                case PRTokeniser.TokType.START_ARRAY: {
                    ++readDepth;
                    PdfArray arr = ReadArray();
                    --readDepth;
                    return arr;
                }
                case PRTokeniser.TokType.NUMBER:
                    return new PdfNumber(tokens.StringValue);
                case PRTokeniser.TokType.STRING:
                    PdfString str = new PdfString(tokens.StringValue, null).SetHexWriting(tokens.IsHexString());
                    str.SetObjNum(objNum, objGen);
                    if (strings != null)
                        strings.Add(str);
                    return str;
                case PRTokeniser.TokType.NAME: {
                    PdfName cachedName;
                    PdfName.staticNames.TryGetValue(tokens.StringValue, out cachedName);
                    if (readDepth > 0 && cachedName != null) {
                        return cachedName;
                    } else {
                        // an indirect name (how odd...), or a non-standard one
                        return new PdfName(tokens.StringValue, false);
                    }
                }
                case PRTokeniser.TokType.REF:
                    int num = tokens.Reference;
                    PRIndirectReference refi = new PRIndirectReference(this, num, tokens.Generation);
                    return refi;
                case PRTokeniser.TokType.ENDOFFILE:
                    throw new IOException(MessageLocalization.GetComposedMessage("unexpected.end.of.file"));
                default:
                    String sv = tokens.StringValue;
                    if ("null".Equals(sv)) {
                        if (readDepth == 0) {
                            return new PdfNull();
                        } //else
                        return PdfNull.PDFNULL;
                    }
                    else if ("true".Equals(sv)) {
                        if (readDepth == 0) {
                            return new PdfBoolean( true );
                        } //else
                        return PdfBoolean.PDFTRUE;
                    }
                    else if ("false".Equals(sv)) {
                        if (readDepth == 0) {
                            return new PdfBoolean( false );
                        } //else
                        return PdfBoolean.PDFFALSE;
                    }
                    return new PdfLiteral(-(int)type, tokens.StringValue);
            }
        }
开发者ID:,项目名称:,代码行数:89,代码来源:


示例12: PdfObjectCheckTest3

        virtual public void PdfObjectCheckTest3()
        {
            string filename = OUT + "PdfObjectCheckTest3.pdf";
            FileStream fos = new FileStream(filename, FileMode.Create);

            Document document = new Document();

            PdfAWriter writer = PdfAWriter.GetInstance(document, fos, PdfAConformanceLevel.PDF_A_1B);
            writer.CreateXmpMetadata();

            document.Open();


            Font font = FontFactory.GetFont(RESOURCES + "FreeMonoBold.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED, 12);
            document.Add(new Paragraph("Hello World", font));

            FileStream iccProfileFileStream = File.Open(RESOURCES + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read, FileShare.Read);
            ICC_Profile icc = ICC_Profile.GetInstance(iccProfileFileStream);
            iccProfileFileStream.Close();

            writer.SetOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);

            String str = "";
            for (int i = 0; i < 65535; i++)
            {
                str += 'a';
            }
            PdfString pdfStr = new PdfString(str);
            writer.ExtraCatalog.Put(new PdfName("TestString"), pdfStr);
            document.Close();
        }
开发者ID:,项目名称:,代码行数:31,代码来源:


示例13: CreateAnnotation

 public override PdfAnnotation CreateAnnotation(float llx, float lly, float urx, float ury, PdfString title, PdfString content, PdfName subtype)
 {
     PdfAnnotation a = base.CreateAnnotation(llx, lly, urx, ury, title, content, subtype);
     if (!PdfName.POPUP.Equals(subtype))
         a.Put(PdfName.F, new PdfNumber(PdfAnnotation.FLAGS_PRINT));
     return a;
 }
开发者ID:unifamz,项目名称:UniversityManagementSystem,代码行数:7,代码来源:PdfAStamperImp.cs


示例14: 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


示例15: SetLabel

 /**
  * A text string specifying a label for displaying the units represented by
  * this NumberFormat in a user interface; the label should use a universally
  * recognized abbreviation.
  * 
  * @param label
  */
 virtual public void SetLabel(PdfString label) {
     base.Put(PdfName.U, label);
 }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:10,代码来源:NumberFormatDictionary.cs


示例16: SetName

 /**
  * (Optional) A descriptive text string or title of the viewport, intended
  * for use in a user interface.
  *
  * @param value
  */
 virtual public void SetName(PdfString value) {
     base.Put(PdfName.NAME, value);
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:9,代码来源:Viewport.cs


示例17: 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


示例18: SetScaleRatio

 /**
  * A text string expressing the scale ratio of the drawing in the region
  * corresponding to this dictionary. Universally recognized unit
  * abbreviations should be used, either matching those of the number format
  * arrays in this dictionary or those of commonly used scale ratios.<br />
  * If the scale ratio differs in the x and y directions, both scales should
  * be specified.
  *
  * @param scaleratio
  */
 public void SetScaleRatio(PdfString scaleratio)
 {
     Put(new PdfName("R"), scaleratio);
 }
开发者ID:boecko,项目名称:iTextSharp,代码行数:14,代码来源:MeasureRectilinear.cs


示例19: SetFieldProperty

 /**
 * Sets a field property. Valid property names are:
 * <p>
 * <ul>
 * <li>textfont - sets the text font. The value for this entry is a <CODE>BaseFont</CODE>.<br>
 * <li>textcolor - sets the text color. The value for this entry is a <CODE>java.awt.Color</CODE>.<br>
 * <li>textsize - sets the text size. The value for this entry is a <CODE>Float</CODE>.
 * <li>bgcolor - sets the background color. The value for this entry is a <CODE>java.awt.Color</CODE>.
 *     If <code>null</code> removes the background.<br>
 * <li>bordercolor - sets the border color. The value for this entry is a <CODE>java.awt.Color</CODE>.
 *     If <code>null</code> removes the border.<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, Object 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);
     PdfDictionary merged;
     PdfString da;
     if (Util.EqualsIgnoreCase(name, "textfont")) {
         for (int k = 0; k < item.Size; ++k) {
             if (hit.IsHit(k)) {
                 merged = item.GetMerged( k );
                 da = merged.GetAsString(PdfName.DA);
                 PdfDictionary dr = merged.GetAsDict(PdfName.DR);
                 if (da != null && dr != null) {
                     Object[] dao = SplitDAelements(da.ToUnicodeString());
                     PdfAppearance cb = new PdfAppearance();
                     if (dao[DA_FONT] != null) {
                         BaseFont bf = (BaseFont)value;
                         PdfName psn = (PdfName)PdfAppearance.stdFieldFontNames[bf.PostscriptFontName];
                         if (psn == null) {
                             psn = new PdfName(bf.PostscriptFontName);
                         }
                         PdfDictionary fonts = dr.GetAsDict(PdfName.FONT);
                         if (fonts == null) {
                             fonts = new PdfDictionary();
                             dr.Put(PdfName.FONT, fonts);
                         }
                         PdfIndirectReference fref = (PdfIndirectReference)fonts.Get(psn);
                         PdfDictionary top = reader.Catalog.GetAsDict(PdfName.ACROFORM);
                         MarkUsed(top);
                         dr = top.GetAsDict(PdfName.DR);
                         if (dr == null) {
                             dr = new PdfDictionary();
                             top.Put(PdfName.DR, dr);
                         }
                         MarkUsed(dr);
                         PdfDictionary fontsTop = dr.GetAsDict(PdfName.FONT);
                         if (fontsTop == null) {
                             fontsTop = new PdfDictionary();
                             dr.Put(PdfName.FONT, fontsTop);
                         }
                         MarkUsed(fontsTop);
                         PdfIndirectReference frefTop = (PdfIndirectReference)fontsTop.Get(psn);
                         if (frefTop != null) {
                             if (fref == null)
                                 fonts.Put(psn, frefTop);
                         }
                         else if (fref == null) {
                             FontDetails fd;
                             if (bf.FontType == BaseFont.FONT_TYPE_DOCUMENT) {
                                 fd = new FontDetails(null, ((DocumentFont)bf).IndirectReference, bf);
                             }
                             else {
                                 bf.Subset = false;
                                 fd = writer.AddSimple(bf);
                                 localFonts[psn.ToString().Substring(1)] = bf;
                             }
                             fontsTop.Put(psn, fd.IndirectReference);
                             fonts.Put(psn, fd.IndirectReference);
                         }
                         ByteBuffer buf = cb.InternalBuffer;
                         buf.Append(psn.GetBytes()).Append(' ').Append((float)dao[DA_SIZE]).Append(" Tf ");
                         if (dao[DA_COLOR] != null)
                             cb.SetColorFill((Color)dao[DA_COLOR]);
                         PdfString s = new PdfString(cb.ToString());
                         item.GetMerged(k).Put(PdfName.DA, s);
                         item.GetWidget(k).Put(PdfName.DA, s);
                         MarkUsed(item.GetWidget(k));
                     }
                 }
             }
         }
     }
     else if (Util.EqualsIgnoreCase(name, "textcolor")) {
         for (int k = 0; k < item.Size; ++k) {
             if (hit.IsHit(k)) {
                 merged = item.GetMerged( k );
                 da = merged.GetAsString(PdfName.DA);
//.........这里部分代码省略.........
开发者ID:JamieMellway,项目名称:iTextSharpLGPL-Monotouch,代码行数:101,代码来源:AcroFields.cs


示例20: AddChar

 internal override void AddChar(PdfString mark, PdfObject code) {
     if (!(code is PdfNumber))
         return;
     byte[] ser = DecodeStringToByte(mark);
     map[((PdfNumber)code).IntValue] = ser;
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:6,代码来源:CMapCidByte.cs



注:本文中的iTextSharp.text.pdf.PdfString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# pdf.PdfTemplate类代码示例发布时间:2022-05-26
下一篇:
C# pdf.PdfStream类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap