PdfPig
PdfPig copied to clipboard
Handles fonts reported as incorrect type
Page p = this.pdfDocument.GetPage(pageNumber);
I exported the first font found ("F1" on page 1 as f1.ttf contained in f1.zip).
FontForge will load it so will look if a change is required to lib (TrueType font) parser.

So lib (PdfPig) is correct (to the PDF spec). Many of the fonts in the PDF have a font description that expects a True Type Font (TTF) (using a stream dictionary entry of FontFile2) however the font stored is an Adobe Compact Font Format (CFF).

For other libraries the consensus appears to be to consider all the Font Description (FontFile, FontFile2, FontFile3) a generic byte steam and then inspect the stream to determine the font format (TTF, CCF, etc).
As short term fix in
\src\UglyToad.PdfPig\PdfFonts\Parser\Parts\CidFontFactory.cs before line 118 add
if (fontFile[0] == 0x01 && fontFile[1] == 00) { var font = CompactFontFormatParser.Parse(new CompactFontFormatData(fontFile)); return new PdfCidCompactFontFormatFont(font); }
From

to

To be able to get most text from the pages had to make the following changes in
\src\UglyToad.PdfPig\PdfFonts\Parser\Parts\CidFontFactory.cs

Example text (page 2):
本公司为新中国第一家全国性保险公司,成立于1949年10月1日,目前已成长为国内领先的大型综合性保险金融集团,于2012年12月在香港联交所上市(H股股票代码:1339),2018年11月在上交所上市(A股股票代码:601319)。本公司在2022年《财富》杂志刊发的世界500强中排名第110位。本公司分别通过人保财险(于香港联交所上市,股票代码:2328)和人保香港(本公司分别持有约68.98%和89.36%的股权)在中国境内和中国香港经营财产险业务;分别通过人保寿险(本公司直接及间接持有80.00%的股权)和人保健康(本公司直接及间接持有约95.45%的股权)经营寿险和健康险业务;通过人保资产(本公司持有100%的股权)对大部分保险资金进行集中化和专业化运用管理,通过人保养老(本公司持有100%的股权)开展企业年金、职业年金等业务,以人保投控(本公司持有100%的股权)作为专业化的不动产和养老投资管理平台,以人保资本(本公司持有100%的股权)作为聚焦债权、股权、不动产投资和保险私募股权基金投资等另类投资的保险资产管理公司;通过人保再保(本公司直接及间接持有100%的股权)开展集团内外专业再保险业务;以人保金服(本公司直接及间接持有100%的股权)作为为全集团服务的互联网平台;通过人保科技(本公司持有100%的股权)统筹建设本集团信息技术平台,实现科技赋能;并在银行、信托等非保险金融领域进行了战略布局。公司简介

Testing more before raising lib changes.
@fnatzke Thank you, your reply was quick and thoughtfully given
