How do I embed a vectorized image such as EPS, center text?

Q: I am able to do everything I need to do with PDFNet library except
I cannot embed a vectorized image such as EPS.
--------

A: PDFNet does not support EPS, however you can scale and place one
PDF page on top of another PDF page. PDF can contain vector art, text,
and images (EPS graphics can be easily converted to PDF using
Distiller or some other tool).
For a concrete sample code please take a look at the ImpositionTest
sample project (www.pdftron.com/net/samplecode.html#Imposition).

The code may look along the following lines:

Page existing_page = ...

ElementBuilder builder = new ElementBuilder(); ElementWriter writer
= new ElementWriter();

// To write the page behind the (static) content of existing page pass
'true'
// as the second parameter to writer.Begin(existing_page, true).
writer.Begin(existing_page);

Element element = builder.CreateForm(import_page, existing_page_doc);
double scale = Math.Min(existing_page.GetPageWidth()/
import_page.GetPageWidth(),
  existing_page.GetPageHeight()/import_page.GetPageHeight());
element.GetGState().SetTransform(scale, 0, 0, scale, pos_x, pos_y);
writer.WritePlacedElement(element);
writer.End();

writer.Dispose();
builder.Dispose();

Q: The embedded PDF as a vectorized image works beautifully. Thank
you.

I have been wracking my brains out trying to center Unicode and I
could not find any examples or explanations of how to really do this.
Here is what I have (in C++):

Font fnt;
fnt = Font::CreateCIDTrueTypeFont( doc, "MSMINCHO.TTF", true, true );
Element element = eb.CreateTextBegin( fnt, 1 );
writer.WriteElement(element);

element = eb.CreateUnicodeTextRun( uUnicodeString, iStringLength);
element.SetTextMatrix( 10, 0, 0, 10, ((8.5*72)-
element.GetTextLength())/2.0, 250 );

This is what the examples say to do, but element.GetTextLength() seems
to return half the string length.
------------
A: The problem is due to text scaling (which is not reflected in
GetTextLength()). To fix this issue specify the font text size in
CreateTextBegin(), and set the scaling component in SetTextMatrix() to
1. Alternatively you can keep the code as before, but then you would
need to multiply the return value from GetTextLength() by the scaling
component (i.e. 10 in you case).

Element element = eb.CreateTextBegin(fnt, 10);
writer.WriteElement(element); // iStringLength - number of Unicode
characters.
element = eb.CreateUnicodeTextRun(uUnicodeString, iStringLength);
element.SetTextMatrix(1, 0, 0, 1, (page.GetPageWidth()-
element.GetTextLength())/2.0, 250);

Thank you for your help.

The text does render properly. I think I guessed the solution. I
dumbly multiplied the font size by what I get from
element.GetTextLength().

  fntsize = 12;
  element = eb.CreateUnicodeTextRun( uUnicodeString, (iStringLength*2)/
sizeof(Unicode));
  element.SetTextMatrix( fntsize, 0, 0, fntsize, ((8.5*72)-
element.GetTextLength()*fntsize)/2.0, iVerticalStart -
iVerticalOffset );
  writer.WriteElement( element );

I didn't think this would work with a variable font like MSMINCHO but
the results look good.

Thank you for your help.