Greetings, i'm having some problems trying to use unicode characters …
In CreationTest.cpp there is this code:
void CreateUnicodeAnnotationFreeText( PdfPage* pPage, PdfDocument* pDocument )
{
PdfString sJap(reinterpret_cast<const pdf_utf8*>("「PoDoFo」は今から日本語も話せます。"));
PdfFont* pFont = pDocument->CreateFont( "Arial Unicode MS", new
PdfIdentityEncoding( 0, 0xffff, true ) );
PdfRect rect( 200.0, 200.0, 200.0, 200.0 );
std::ostringstream oss;
oss << "BT" << std::endl << "/" << pFont->GetIdentifier().GetName()
<< " " << pFont->GetFontSize()
<< " Tf " << std::endl;
WriteStringToStream( sJap, oss, pFont );
oss << "Tj ET" << std::endl;
PdfDictionary fonts;
fonts.AddKey(pFont->GetIdentifier().GetName(),
pFont->GetObject()->Reference());
PdfDictionary resources;
resources.AddKey( PdfName("Fonts"), fonts );
PdfAnnotation* pAnnotation =
pPage->CreateAnnotation( ePdfAnnotation_FreeText, rect );
PdfString sGerman(reinterpret_cast<const pdf_utf8*>("Unicode Umlauts:
ÄÖÜß"));
pAnnotation->SetTitle( sGerman );
pAnnotation->SetContents( sJap );
//pAnnotation->SetAppearanceStream( &xObj );
pAnnotation->GetObject()->GetDictionary().AddKey( PdfName("DA"),
PdfString(oss.str()) );
pAnnotation->GetObject()->GetDictionary().AddKey( PdfName("DR"), resources
);
}
But when i try to create the font, pFont returns NULL
Any idea why this is happening?
if not, how can i write unicode characters into a PdfStream when creating a
FreeText annotation?
The problem is that adobe viewers (among others) don't display the annotation
properly because the stream isn't properly drawn
It is invisible until selected, and then it becomes visible
(searching through the pdf structure, i found that the Tj command in the
annotations content stream has no value)
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users