當前位置: 首頁>>代碼示例>>C#>>正文


C# Chunk.SetTextRenderMode方法代碼示例

本文整理匯總了C#中iTextSharp.text.Chunk.SetTextRenderMode方法的典型用法代碼示例。如果您正苦於以下問題:C# Chunk.SetTextRenderMode方法的具體用法?C# Chunk.SetTextRenderMode怎麽用?C# Chunk.SetTextRenderMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.Chunk的用法示例。


在下文中一共展示了Chunk.SetTextRenderMode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: EndElement

// ---------------------------------------------------------------------------
    public void EndElement(string name) {
      if ("big".Equals(name)) {
        Chunk bold = new Chunk(Strip(buf), f);
        bold.SetTextRenderMode(
          PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, 0.5f,
          GrayColor.GRAYBLACK
        );
        Paragraph p = new Paragraph(bold);
        p.Alignment = Element.ALIGN_LEFT;
        cell.AddElement(p);
        buf = new StringBuilder();
      }
      else if ("message".Equals(name)) {
        Paragraph p = new Paragraph(Strip(buf), f);
        p.Alignment = Element.ALIGN_LEFT;
        cell.AddElement(p);
        table.AddCell(cell);
        buf = new StringBuilder();
      }
      else if ("pace".Equals(name)) {
        document.Add(table);
      }
    }
開發者ID:,項目名稱:,代碼行數:24,代碼來源:

示例2: Write


//.........這裏部分代碼省略.........
         document.Add(new Paragraph(String.Format(
           "Chunk width: {0}", c.GetWidthPoint()
         )));
         document.Add(Chunk.NEWLINE);
         // Ascent and descent of the String
         document.Add(new Paragraph(
           "Ascent Helvetica: " + bf_helv.GetAscentPoint(foobar, 12)
         ));
         document.Add(new Paragraph(
           "Ascent Times: " + bf_times.GetAscentPoint(foobar, 12)
         ));
         document.Add(new Paragraph(
           "Descent Helvetica: " + bf_helv.GetDescentPoint(foobar, 12)
         ));
         document.Add(new Paragraph(
           "Descent Times: " + bf_times.GetDescentPoint(foobar, 12)
         ));
         document.Add(Chunk.NEWLINE);
         // Kerned text
         width_helv = bf_helv.GetWidthPointKerned(foobar, 12);
         c = new Chunk(foobar + ": " + width_helv, helvetica);
         document.Add(new Paragraph(c));
         // Drawing lines to see where the text is added
         PdfContentByte canvas = writer.DirectContent;
         canvas.SaveState();
         canvas.SetLineWidth(0.05f);
         canvas.MoveTo(400, 806);
         canvas.LineTo(400, 626);
         canvas.MoveTo(508.7f, 806);
         canvas.LineTo(508.7f, 626);
         canvas.MoveTo(280, 788);
         canvas.LineTo(520, 788);
         canvas.MoveTo(280, 752);
         canvas.LineTo(520, 752);
         canvas.MoveTo(280, 716);
         canvas.LineTo(520, 716);
         canvas.MoveTo(280, 680);
         canvas.LineTo(520, 680);
         canvas.MoveTo(280, 644);
         canvas.LineTo(520, 644);
         canvas.Stroke();
         canvas.RestoreState();
         // Adding text with PdfContentByte.ShowTextAligned()
         canvas.BeginText();
         canvas.SetFontAndSize(bf_helv, 12);
         canvas.ShowTextAligned(Element.ALIGN_LEFT, foobar, 400, 788, 0);
         canvas.ShowTextAligned(Element.ALIGN_RIGHT, foobar, 400, 752, 0);
         canvas.ShowTextAligned(Element.ALIGN_CENTER, foobar, 400, 716, 0);
         canvas.ShowTextAligned(Element.ALIGN_CENTER, foobar, 400, 680, 30);
         canvas.ShowTextAlignedKerned(Element.ALIGN_LEFT, foobar, 400, 644, 0);
         canvas.EndText();
         // More lines to see where the text is added
         canvas.SaveState();
         canvas.SetLineWidth(0.05f);
         canvas.MoveTo(200, 590);
         canvas.LineTo(200, 410);
         canvas.MoveTo(400, 590);
         canvas.LineTo(400, 410);
         canvas.MoveTo(80, 572);
         canvas.LineTo(520, 572);
         canvas.MoveTo(80, 536);
         canvas.LineTo(520, 536);
         canvas.MoveTo(80, 500);
         canvas.LineTo(520, 500);
         canvas.MoveTo(80, 464);
         canvas.LineTo(520, 464);
         canvas.MoveTo(80, 428);
         canvas.LineTo(520, 428);
         canvas.Stroke();
         canvas.RestoreState();
         // Adding text with ColumnText.ShowTextAligned()
         Phrase phrase = new Phrase(foobar, times);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, phrase, 200, 572, 0);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_RIGHT, phrase, 200, 536, 0);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_CENTER, phrase, 200, 500, 0);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_CENTER, phrase, 200, 464, 30);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_CENTER, phrase, 200, 428, -30);
         // Chunk attributes
         c = new Chunk(foobar, times);
         c.SetHorizontalScaling(0.5f);
         phrase = new Phrase(c);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, phrase, 400, 572, 0);
         c = new Chunk(foobar, times);
         c.SetSkew(15, 15);
         phrase = new Phrase(c);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, phrase, 400, 536, 0);
         c = new Chunk(foobar, times);
         c.SetSkew(0, 25);
         phrase = new Phrase(c);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, phrase, 400, 500, 0);
         c = new Chunk(foobar, times);
         c.SetTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_STROKE, 0.1f, BaseColor.RED);
         phrase = new Phrase(c);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, phrase, 400, 464, 0);
         c = new Chunk(foobar, times);
         c.SetTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, 1, null);
         phrase = new Phrase(c);
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, phrase, 400, 428, -0);
     }
 }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:101,代碼來源:FoobarFilmFestival.cs


注:本文中的iTextSharp.text.Chunk.SetTextRenderMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。