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() 
);
&nbsp; &nbsp; PdfString sJap(reinterpret_cast<const 
pdf_utf8*&gt;("??Po\tDoFo??????????"));
&nbsp; &nbsp; const long&nbsp; &nbsp; &nbsp;lUtf8BufferLen = 256;
&nbsp; &nbsp; pdf_utf8 pUtf8Buffer[lUtf8BufferLen];




&nbsp; &nbsp; PdfString::ConvertUTF16toUTF8( sJap.GetUnicode(), 
sJap.GetUnicodeLength(), pUtf8Buffer, lUtf8BufferLen&nbsp; );
&nbsp; &nbsp; printf("UNIC: %s\n", pUtf8Buffer );


&nbsp; &nbsp; pFont-&gt;SetFontSize( 18.0 );
&nbsp; &nbsp; pPainter-&gt;SetFont( pFont );
&nbsp; &nbsp; pPainter-&gt;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-&gt;GetPageSize().GetWidth();

double h = pPage-&gt;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

Reply via email to