Process() public method

public Process ( String text ) : Phrase
text String
return iTextSharp.text.Phrase
        private Phrase ComposePhrase(String text, BaseFont ufont, BaseColor color, float fontSize)
        {
            Phrase phrase = null;

            if (extensionFont == null && (substitutionFonts == null || substitutionFonts.Count == 0))
            {
                phrase = new Phrase(new Chunk(text, new Font(ufont, fontSize, 0, color)));
            }
            else
            {
                FontSelector fs = new FontSelector();
                fs.AddFont(new Font(ufont, fontSize, 0, color));
                if (extensionFont != null)
                {
                    fs.AddFont(new Font(extensionFont, fontSize, 0, color));
                }
                if (substitutionFonts != null)
                {
                    foreach (BaseFont bf in substitutionFonts)
                    {
                        fs.AddFont(new Font(bf, fontSize, 0, color));
                    }
                }
                phrase = fs.Process(text);
            }
            return(phrase);
        }
// ---------------------------------------------------------------------------
    public void Write(Stream stream) {
      // step 1
      using (Document document = new Document(PageSize.A4)) {
        // step 2
        PdfWriter.GetInstance(document, stream);
        // step 3
        document.Open();
        // step 4
        FontSelector selector = new FontSelector();
        selector.AddFont(FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12));
        selector.AddFont(FontFactory.GetFont(
          "MSung-Light", "UniCNS-UCS2-H", BaseFont.NOT_EMBEDDED
        ));
        Phrase ph = selector.Process(TEXT);
        document.Add(new Paragraph(ph));
      }
    }
Example #3
0
 private Phrase ComposePhrase(String text, BaseFont ufont, BaseColor color, float fontSize) {
     Phrase phrase = null;
     if (extensionFont == null && (substitutionFonts == null || substitutionFonts.Count == 0))
         phrase = new Phrase(new Chunk(text, new Font(ufont, fontSize, 0, color)));
     else {
         FontSelector fs = new FontSelector();
         fs.AddFont(new Font(ufont, fontSize, 0, color));
         if (extensionFont != null)
             fs.AddFont(new Font(extensionFont, fontSize, 0, color));
         if (substitutionFonts != null) {
             foreach (BaseFont bf in substitutionFonts) {
                 fs.AddFont(new Font(bf, fontSize, 0, color));
             }
         }
         phrase = fs.Process(text);
     }
     return phrase;
 }
Example #4
0
 private Anchor getAnchor(FontSelector fontSelector, CellAttributes attributes)
 {
     var text = getText(attributes);
     var url = getUrl(attributes);
     var anchor = new Anchor(fontSelector.Process(text.ToSafeString())) { Reference = url };
     return anchor;
 }