public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir_WorkingWithText(); // Create new XPS Document XpsDocument doc = new XpsDocument(); // Add Text XpsSolidColorBrush textFill = doc.CreateSolidColorBrush(Color.Black); XpsGlyphs glyphs = doc.AddGlyphs("Arial", 20, FontStyle.Regular, 400f, 200f, "TEN. rof SPX.esopsA"); glyphs.BidiLevel = 1; glyphs.Fill = textFill; // Save resultant XPS document doc.Save(dataDir + "AddText_out.xps"); // ExEnd:1 }
public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir_WorkingWithText(); // Create new XPS Document XpsDocument doc = new XpsDocument(); //Create a brush XpsSolidColorBrush textFill = doc.CreateSolidColorBrush(Color.Black); //Add glyph to the document XpsGlyphs glyphs = doc.AddGlyphs("Arial", 12, FontStyle.Regular, 300f, 450f, "Hello World!"); glyphs.Fill = textFill; // Save resultant XPS document doc.Save(dataDir + "AddText_out.xps"); // ExEnd:1 }
private void AddText(AsposePageDocumentInfo doc, string signatureText, string signatureTextColor) { XpsDocument document = doc.Document as XpsDocument; XpsSolidColorBrush textFill = document.CreateSolidColorBrush(Color.Black); if (signatureTextColor != "") { if (!signatureTextColor.StartsWith("#")) { signatureTextColor = "#" + signatureTextColor; } textFill = document.CreateSolidColorBrush(System.Drawing.ColorTranslator.FromHtml(signatureTextColor)); } //Add glyph to the document XpsGlyphs glyphs = document.AddGlyphs("Arial", 24, FontStyle.Regular, 450f, 50f, signatureText); glyphs.Fill = textFill; }