当前位置: 首页>>代码示例>>C#>>正文


C# Chunk.SetGenericTag方法代码示例

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


在下文中一共展示了Chunk.SetGenericTag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Write

// ---------------------------------------------------------------------------
    public void Write(Stream stream) {
      // step 1
      using (Document document = new Document()) {
        // step 2
        PdfWriter writer = PdfWriter.GetInstance(document, stream);
        writer.PageEvent = new AnnotationHelper();
        // step 3
        document.Open();
        // step 4
        Paragraph p = new Paragraph();
        Chunk chunk;
        Chunk tab = new Chunk(new VerticalPositionMark());
        for (int i = 0; i < ICONS.Length; i++) {
          chunk = new Chunk(ICONS[i]);
          chunk.SetGenericTag(ICONS[i]);
          p.Add(chunk);
          p.Add(tab);
        }        
        document.Add(p); 
      }
    }
开发者ID:,项目名称:,代码行数:22,代码来源:

示例2: GetPhrase

 public static Phrase GetPhrase(Properties attributes)
 {
     Phrase phrase = new Phrase();
     phrase.Font = FontFactory.GetFont(attributes);
     String value;
     value = attributes[ElementTags.LEADING];
     if (value != null) {
         phrase.Leading = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     value = attributes[Markup.CSS_KEY_LINEHEIGHT];
     if (value != null) {
         phrase.Leading = Markup.ParseLength(value, Markup.DEFAULT_FONT_SIZE);
     }
     value = attributes[ElementTags.ITEXT];
     if (value != null) {
         Chunk chunk = new Chunk(value);
         if ((value = attributes[ElementTags.GENERICTAG]) != null) {
             chunk.SetGenericTag(value);
         }
         phrase.Add(chunk);
     }
     return phrase;
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:23,代码来源:ElementFactory.cs

示例3: GetChunk

        public static Chunk GetChunk(Properties attributes)
        {
            Chunk chunk = new Chunk();

            chunk.Font = FontFactory.GetFont(attributes);
            String value;

            value = attributes[ElementTags.ITEXT];
            if (value != null) {
                chunk.Append(value);
            }
            value = attributes[ElementTags.LOCALGOTO];
            if (value != null) {
                chunk.SetLocalGoto(value);
            }
            value = attributes[ElementTags.REMOTEGOTO];
            if (value != null) {
                String page = attributes[ElementTags.PAGE];
                if (page != null) {
                    chunk.SetRemoteGoto(value, int.Parse(page));
                }
                else {
                    String destination = attributes[ElementTags.DESTINATION];
                    if (destination != null) {
                        chunk.SetRemoteGoto(value, destination);
                    }
                }
            }
            value = attributes[ElementTags.LOCALDESTINATION];
            if (value != null) {
                chunk.SetLocalDestination(value);
            }
            value = attributes[ElementTags.SUBSUPSCRIPT];
            if (value != null) {
                chunk.SetTextRise(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            value = attributes[Markup.CSS_KEY_VERTICALALIGN];
            if (value != null && value.EndsWith("%")) {
                float p = float.Parse(value.Substring(0, value.Length - 1), System.Globalization.NumberFormatInfo.InvariantInfo) / 100f;
                chunk.SetTextRise(p * chunk.Font.Size);
            }
            value = attributes[ElementTags.GENERICTAG];
            if (value != null) {
                chunk.SetGenericTag(value);
            }
            value = attributes[ElementTags.BACKGROUNDCOLOR];
            if (value != null) {
                chunk.SetBackground(Markup.DecodeColor(value));
            }
            return chunk;
        }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:51,代码来源:ElementFactory.cs

示例4: Paragraph

 /// <summary>
 /// Returns a Paragraph that has been constructed taking in account
 /// the value of some attributes.
 /// </summary>
 /// <param name="attributes">Some attributes</param>
 public Paragraph(Properties attributes)
     : this("", FontFactory.GetFont(attributes))
 {
     string value;
     if ((value = attributes.Remove(ElementTags.ITEXT)) != null) {
         Chunk chunk = new Chunk(value);
         if ((value = attributes.Remove(ElementTags.GENERICTAG)) != null) {
             chunk.SetGenericTag(value);
         }
         Add(chunk);
     }
     if ((value = attributes.Remove(ElementTags.ALIGN)) != null) {
         SetAlignment(value);
     }
     if ((value = attributes.Remove(ElementTags.LEADING)) != null) {
         this.Leading = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     else if ((value = attributes.Remove(Markup.CSS_KEY_LINEHEIGHT)) != null) {
         this.Leading = Markup.ParseLength(value);
     }
     else {
         this.Leading = 16;
     }
     if ((value = attributes.Remove(ElementTags.INDENTATIONLEFT)) != null) {
         this.IndentationLeft = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     if ((value = attributes.Remove(ElementTags.INDENTATIONRIGHT)) != null) {
         IndentationRight = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     if ((value = attributes.Remove(ElementTags.KEEPTOGETHER)) != null) {
         keeptogether = bool.Parse(value);
     }
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:38,代码来源:Paragraph.cs

示例5: Create

 /**
 * Create an index entry.
 *
 * @param text  The text for the Chunk.
 * @param in1   The first level.
 * @param in2   The second level.
 * @param in3   The third level.
 * @return Returns the Chunk.
 */
 public Chunk Create(String text, String in1, String in2,
         String in3)
 {
     Chunk chunk = new Chunk(text);
     String tag = "idx_" + (indexcounter++);
     chunk.SetGenericTag(tag);
     chunk.SetLocalDestination(tag);
     Entry entry = new Entry(in1, in2, in3, tag, this);
     indexentry.Add(entry);
     return chunk;
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:20,代码来源:IndexEvents.cs

示例6: Anchor

 /// <summary>
 /// Returns an Anchor that has been constructed taking in account
 /// the value of some <var>attributes</var>.
 /// </summary>
 /// <param name="attributes">Some attributes</param>
 public Anchor(Properties attributes)
     : this("", FontFactory.GetFont(attributes))
 {
     string value;
     if ((value = attributes.Remove(ElementTags.ITEXT)) != null)
     {
         Chunk chunk = new Chunk(value);
         if ((value = attributes.Remove(ElementTags.GENERICTAG)) != null)
         {
             chunk.SetGenericTag(value);
         }
         Add(chunk);
     }
     if ((value = attributes.Remove(ElementTags.LEADING)) != null)
     {
         Leading = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     else if ((value = attributes.Remove(Markup.CSS_KEY_LINEHEIGHT)) != null)
     {
         this.Leading = Markup.ParseLength(value);
     }
     if ((value = attributes.Remove(ElementTags.NAME)) != null)
     {
         this.Name = value;
     }
     if ((value = attributes.Remove(ElementTags.REFERENCE)) != null)
     {
         this.Reference = value;
     }
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:35,代码来源:Anchor.cs

示例7: TestImageChunkOnGenericTag

        public void TestImageChunkOnGenericTag() {
            String fileName = "testImageChunkOnGenericTag.pdf";
            FileStream fos = new FileStream(TARGET + fileName, FileMode.Create);
            Document doc = new Document(PageSize.LETTER);
            PdfWriter writer = PdfWriter.GetInstance(doc, fos);
            writer.PageEvent = new EventHandler();
            doc.Open();

            Image img = Image.GetInstance(writer.DirectContent.CreateTemplate(100f, 25f));
            Console.WriteLine(img.Height.ToString("F1", CultureInfo.InvariantCulture));
            Chunk c = new Chunk(img, 0, 0);
            c.SetGenericTag("foobar");

            doc.Add(c);
            doc.Close();

            CompareTool compareTool = new CompareTool();
            String error = compareTool.CompareByContent(TARGET + fileName, RESOURCES + "cmp_" + fileName, TARGET, "diff_");
            if (error != null) {
                Assert.Fail(error);
            }
        }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:22,代码来源:ChunkTest.cs


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