我知道这已经有一段时间了,因为你问了这个问题,但我想我可能会提供帮助。
我不知道是否有任何实用工具可以让您提取字体文件,但您可以手动进行。
基本上PDF文件是具有不同对象的文本文件。你可以用任何文本编辑器打开它并查找字体。
的字体在FontDescriptor对象指定的,例如:
<</Type/FontDescriptor/FontName/ABCDEE+Algerian ... /FontFile2 24 0 R>>
这基本上说,与阿尔及利亚在对象24上指定的名称的字体,您可以在文档中搜索对象24与线“24 0 obj”,在这行之后,它显示流的属性和字体文件,并且在它开始的“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);
}
}
我希望这有助于你......或者帮助别人
@willw我也对此感兴趣。我在PDF中找到了相关的流(我认为)。不过,我并不真正了解编程。我如何编译和运行这个脚本?它在哪里得到我的输入文件?我是否也可以将流字符复制并粘贴到新的文本文件中以生成有效的输入文件?有没有可以接受此文件并输出解压缩文件的在线解码器?对不起,有10,000个问题。希望你能帮忙。 – CreeDorofl 2011-03-31 03:03:09