0

我正在使用 PoDoFo 0.9.1 库在 Win32 XP 中文版操作系统上读取包含中文字符的 PDF 文件。我发现PoDoFo的示例项目“podofotxtextract”可以优雅地阅读英文PDF,但是,当我打开一个中文PDF文件时,什么都没有解析出来。有人有建议吗?多谢。

4

1 回答 1

0

我使用 Objective C 在现有 PDF 文件上添加注释。
顺便说一句:试试

PdfString pdfString(reinterpret_cast<const pdf_utf8*>("你读到的字符..."));

这是下面的一些代码......

PdfPage* pPage = doc->GetPage(pageIndex);
if (! pPage) {
    // couldn't get that page 
    return;
}
PdfAnnotation* anno;

anno = pPage->CreateAnnotation(ePdfAnnotation_Text, rect);

PdfString sTitle(reinterpret_cast<const pdf_utf8*>([@"中国" UTF8String]));
PdfString sContent(reinterpret_cast<const pdf_utf8*>([@"这是一个中文测试"UTF8String]));
// to parse this annotation
// anno->GetContents().GetStringUtf8().c_str()
anno->SetTitle(sTitle);
anno->SetContents(sContent);
anno->SetOpen(bOpen); 
于 2011-12-29T04:06:46.100 回答