如何使用 C# iTextSharp 在一行中使用多种字体

How to use multiple fonts in a single line Using C# iTextSharp

如何在一行中使用多种字体使用 PdfContentByte

例如:

pcb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "Some normal font" + " Bold Font" + " Some normal font",iXCoordinate, iYCoordinate, 0);

您需要不同版本的 ShowTextAligned() 方法来实现此目的。

ColumnText.ShowTextAligned(pcb, Element.ALIGN_CENTER, phrase, iXCoordinate, iYCoordinate, 0);

phrase参数为Phrase类型,可由Chunk个不同字体的对象组成