Deatr podofoteams:
I recently used podofo to add text to the PDF, but found that the correct
Chinese cannot be added to the PDF under linux (ubuntu). The code I used is the
following paragraph:
pFont = pDocument->CreateFont( "Arial Unicode MS", new
PdfIdentityEncoding( 0, 0xffff, true ) );
printf("GOT: %s\n", pFont->GetFontMetrics()->GetFontname()
);
PdfString sJap(reinterpret_cast<const
pdf_utf8*>("??Po\tDoFo??????????"));
const long lUtf8BufferLen = 256;
pdf_utf8 pUtf8Buffer[lUtf8BufferLen];
PdfString::ConvertUTF16toUTF8( sJap.GetUnicode(),
sJap.GetUnicodeLength(), pUtf8Buffer, lUtf8BufferLen );
printf("UNIC: %s\n", pUtf8Buffer );
pFont->SetFontSize( 18.0 );
pPainter->SetFont( pFont );
pPainter->DrawText( 100.0, 100.0, sJap );
In addition to this, I also used
const PdfEncoding* pp = PdfEncodingFactory::GlobalIdentityEncodingInstance();
PdfFont* pFont = document.CreateFont("SimHei", true, true, false,
pp);//Helvetica
painter.SetFont( pFont );
double w = pPage->GetPageSize().GetWidth();
double h = pPage->GetPageSize().GetHeight();
PdfString str((pdf_utf8* )"????podofo???????????????????????????? \n \n");
painter.DrawMultiLineText( 0, 0, w, h, str);
After I use this code, I cannot find these words in the PDF, so I seek your
help and hope to get a reply, thank you
best wishes
ning
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users