This sample shows how to change the appearance of text to draw rich text. Read More
In PdfDocument, the text can be filled with any color. It can also be stroked or filled and stroked simultaneously.
The drawText's options argument has the fill and stroke properties. Leave these properties empty to indicate that the text should be filled (default). Set stroke to true to indicate that the text should be stroked. Set b>fill and stroke, both to true to indicate that text should be both stroked and filled.
Each call to drawText starts a new paragraph. To indicate that subsequent text should be placed right after the previous one, set the options argument's continued property to true.
doc.drawText("Lorem ", null, null, { continued: true });
doc.drawText("ipsum.");
The fill color can be specified in two ways:
doc.drawText("Lorem", null, null, {
brush: new wijmo.pdf.PdfSolidBrush("#ff000") // or brush: "#ff000"
});
doc.setBrush(new wijmo.pdf.PdfSolidBrush("#ff000")); // or doc.setBrush("#ff000");
doc.drawText("Lorem");
Like the fill color, the stroke color can be specified in the same way by passing a pen to the options.pen property or doc.setPen method.
For more information about brushes and pens, see the "Drawing graphics" topic.
PdfDocument doesn't differentiate between text color and vector graphics color, so changing the default document brush or pen affects the vector graphics API too.