我找不到明确的
fontWeight
成员,就像在iText 5中一样,但没有什么可以阻止我们研究
FontDescriptor
我们自己,例如:
public class MyLocationTextExtractionStrategy : LocationTextExtractionStrategy
{
public override void EventOccurred(IEventData data, EventType type)
{
if (data is TextRenderInfo renderInfo)
{
var oFont = renderInfo.GetFont();
PdfDictionary fontDescriptor = oFont.GetPdfObject().GetAsDictionary(PdfName.FontDescriptor);
PdfNumber number = fontDescriptor?.GetAsNumber(PdfName.FontWeight);
double? weight = number?.GetValue();
[... process weight, it is null if not set in the descriptor ...]
}
base.EventOccurred(data, type);
}
}