【Foxit PDF SDK】福昕GSDK如何在页面中创建一个文本对象?

请参考以下代码:

long position = page.getLastGraphicsObjectPosition(e_TypeText);

TextObject text_object = TextObject.create();

text_object.setFillColor(0xFFFF7F00);

// 创建 text state对象。

TextState state = new TextState();

state.setFont_size(80.0f);

state.setFont(new Font("Simsun", e_StylesSmallCap, e_CharsetGB2312, 0));

state.setTextmode(e_ModeFill);

text_object.setTextState(page, state, false, 750);

//设置文本。

text_object.setText("Foxit Software");

long last_position = page.insertGraphicsObject(position, text_object);

RectF rect = text_object.getRect();

float offset_x = (page.getWidth() – (rect.getRight() – rect.getLeft())) / 2;

float offset_y = page.getHeight() * 0.8f – (rect.getTop() – rect.getBottom()) / 2;

text_object.transform(new Matrix2D(1, 0, 0, 1, offset_x, offset_y), false);

//生成内容。

page.generateContent();