我知道你问这个问题已经有一段时间了,但我想我也许能帮上忙。
我不知道是否有任何实用程序可以让您提取字体文件,但您可以手动完成。
基本上,PDF 文件是具有不同对象的文本文件。您可以使用任何文本编辑器打开它并查找字体。
字体在 FontDescriptor 对象中指定,例如:
<</Type/FontDescriptor/FontName/ABCDEE+Algerian ... /FontFile2 24 0 R>>
这基本上是说,在对象 24 上指定了一个名为 Algerian 的字体。您可以使用“24 0 obj”行在文档中搜索对象 24,在此行之后,它会显示带有字体文件的流的属性并且在“stream”关键字之后开始(它的长度在obj之后的行中定义)。
此流包含压缩的 ttf 文件,要对其进行解压缩,您可以使用以下方法:
private static byte[] DecodeFlateDecodeData(byte[] data)
{
MemoryStream outputStream;
using (outputStream = new MemoryStream())
{
using (var compressedDataStream = new MemoryStream(data))
{
// Remove the first two bytes to skip the header (it isn't recognized by the DeflateStream class)
compressedDataStream.ReadByte();
compressedDataStream.ReadByte();
var deflateStream = new DeflateStream(compressedDataStream, CompressionMode.Decompress, true);
var decompressedBuffer = new byte[1024];
int read;
while ((read = deflateStream.Read(decompressedBuffer, 0, decompressedBuffer.Length)) != 0)
{
outputStream.Write(decompressedBuffer, 0, read);
}
outputStream.Flush();
compressedDataStream.Close();
}
return GetStreamBytes(outputStream);
}
}
我希望这可以帮助你......或帮助其他人