Q:
Is it possible to perserve font type when we use the reader function
and to read in text element, then use the writer function to write
this information on a new page or new document?
element.GetType() == Element.Type.e_text char[] text_char =
element.GetTextString();
---
A:
The problem is that element.GetTextString() returns Unicode mapped
string, but the PDF font may or may not use Unicode encoding (also the
font may be subsetted - meaning that only a subset of glyphs used on
the page are present in the font, etc). The actual text encoding as
used in the page content stream can be obtained using
element.GetTextData(). Unfortunately this data is often not very
useful because the associated font can assume use a number of
different encodings. Usually the best approach is to create a new font
(possibly based on the existing font - font.GetEmbeddedFont() - then
recreate the font) and then write Unicode text using the new font.