1、为了方便,在文件头中加入这个预编译宏,表示把所有的字符当成utf8编码#if defined(_MSC_VER) && (_MSC_VER >= 1600)# pragma execution_character_set("utf-8")#endif

3、告诉垓矗梅硗 PdfString 将字符串当成utf8编码解析double w = pPage->GetPageS足毂忍珩ize().GetWidth(); double h = pPage->GetPageSize().GetHeight(); painter.DrawText( 10, 10, "Hello World!" ); PdfString str((pdf_utf8* )"测试podofo显示中文文本显示是否为乱码! \n \n"); painter.DrawMultiLineText( 0, 0, w, h, str);

5、将上面的锾哩菸谷全部代码段写入到源码中去const PdfEncoding* pp = PdfEncodingFact泠贾高框ory::GlobalIdentityEncodingInstance(); PdfFont* pFont = document.CreateFont("SimHei", true, true, false, pp);//Helvetica painter.SetFont( pFont ); double w = pPage->GetPageSize().GetWidth(); double h = pPage->GetPageSize().GetHeight(); painter.DrawText( 10, 10, "Hello World!" ); PdfString str((pdf_utf8* )"测试podofo显示中文文本显示是否为乱码! \n \n"); painter.DrawMultiLineText( 0, 0, w, h, str);
