1

我尝试使用objective-c 代码来读取mac osx 上的rtf(有图像)。我注意到 mac 上的应用程序 Textedit 总是删除 rtf 文件的图像信息。我在 Windows 上检查 rtf 的二进制代码。rtf 文件总是将图像更改为长文本字符串。

我不确定mac和win上的rtf定义是否有区别?

欢迎任何评论

4

2 回答 2

0

我可能是错的,但我提醒 Mac OS X Textedit 在您添加图像时使用 RTFD 格式,而 Windows 保持在 RTF 上并将数据直接放入文本文件中。

RTFD 是一种包格式(实际上是一个文件夹),将图像分别存储为文件和文本。

于 2012-05-21T15:18:28.660 回答
0

You are kind of correct.

Windows uses and implements the full RTF spec, which allows for embedded images to be written as either Hex code or Hex code converted to binary code.

On Mac, TextEdit will read RTF files just fine but it does not implement the entire spec. Specifically TextEdit ignores RTF streams which have embedded images. This is pure laziness on Apple's part. Instead Apple likes to use RTFD containers which have the image and the RTF code links to that image. Unfortunately these containers do not work in Windows.

What this means? There is no real RTF compatibility between TextEdit and Windows and vice versa. This is a very frustrating problem that has been around for a very long time.

I have filed bug reports with Apple to request that they support the RTF spec. Version 1.9 can be downloaded here.

于 2016-12-06T20:32:44.927 回答