Hello again.
I try to replace some text in the content and met encoding problems.
I made two tests.
1) Add text to the exising PDF with PDFEditor on linux.
All fonts encodings in result pdf - WinAnsiEncoding.
Test app runs on WIndows.
After extracting Content stream I replace like:
std::string contents = <PDF contents>;
replace(contents, "text_in_pdf", PDFTextString().FromUTF8(<utf8
text>).ToString());
and also same way I use for the PDF info (otherwise it doesn't
work):
InfoDictionary &info =
m_pdf->GetDocumentContext().GetTrailerInformation().GetInfo();
info.Title = PDFTextString().FromUTF8(title).ToString();
2) PDF created with xournal on linux (
https://dl.dropboxusercontent.com/u/4571566/Stuff/test1.pdf).
Font encoding is TrueType (DejaVu Sans); test app runs on WIndows.
Content is:
BT 12.00 0 0 -12.00 67.61 131.19
Tm /F5 1 Tf (LIPPS) Tj ET Q
Here
(LIPPS) is hello.
And I can't figure out how to encode and decode content.
What is the encoding of the content stream and how to correctly put
(or replace part with) utf8 text in it?
Maybe encoding depends on font or smth?
I know you provide UnicodeString, but don't know how to use it in
my situation.
Can you help with this?
Thanks!