How do I reuse the same image instance many times in a PDF document?

Q: We have abandoned our idea to provide highlights based on character
offset (especially now that Acrobat Reader X doesn't support it). So
we came up with the idea to 'burn' highlights into the PDF and serve
that back to clients.

For this to happen we are looking for the method that will give us
text in 'reading order' (as implemented by the PDF component) and for
each word in that text it should also provide us with 'word bounding
box' coordinates.

This actually leads me to my next 2 questions.

1. At the moment, for each 'hit' we highlight it using Highlight
annotation and are also 'burning' JPG navigation arrows around it (one
on each side of the Highlight). So there will be lots of embedded
images depending on the number of hits.
Since number of hits can be high, it is adding quite a bit to the size
of resulting PDF. If I understood correctly, we should be able to
embed single image once (as an 'indirect object'?) and then
'place' (reference?) it at desired coordinates? We can also rotate
that same image to get it to point in the opposite direction. How
would we go about that (embed only single image and reference it from
multiple places. we will get back to you if we need help with the
rotation bit)?

If it is of any help here is the code we currently use to embed an
image. It is a 'goto previous hit' one (pointing left).

private void AddPreviousImage(Page page, double width, double height,
double xPos, double yPos) {
  using (ElementBuilder builder = new ElementBuilder())
  {
    using (ElementWriter writer = new ElementWriter())
    {
      writer.Begin(page);
      Image img = Image.Create(_targetDoc, _previousBitmap);
      Element image = builder.CreateImage(img, new Matrix2D(width, 0,
0, height, xPos, yPos));
      writer.WritePlacedElement(image);
      writer.End();
    }
  }
}

2. Given that we are using a JPG image, it will become 'blocky' at
higher text sizes (compared to vector graphics). So, the question is,
how best to go about making this 'arrow picture' a vector based one
(background colour + '>' on top of it)? What about 'storing it once
and reference it multiple times' in a PDF?
---------------------
A:

How would we go about that (embed only single image and reference it from multiple places.

If you take a look at the first code sample in ElementBuilder test
sample project (http://www.pdftron.com/pdfnet/
samplecode.html#ElementBuilder) you will notice that the same image
instance is used three times on the same page. So you code to reuse an
existing PDF resource (e.g. an image, a font, an xobject, etc.) could
look as follows:

  static pdftron.PDF.Image my_image = null;
  pdftron.PDF.Image GetImage(PDFDoc doc) {
    if (my_image == null) {
      my_image = pdftron.PDF.Image.Create(doc, "my.jpg");
   }
   return my_image;
  }

Then each time you need to place the image you would use the same
image instance. For example:

Element element = element_builder.CreateImage( GetImage(doc) , new
Matrix2D(200, 0, 0, 250, 50, 500));
writer.WritePlacedElement(element);

how best to go about making this 'arrow picture' a vector based one

There are multiple ways. You could draw path objects (e.g.
representing an error) using ElementBuilder and ElementWriter (as
shown in ElementBuilder sample). Using the same approach you can also
create a form xobject and place it on the page similar to image
elements. In case you would rather reuse some piece of vector art
available in the form of a PDF page, you could create a form xobject
from the page and then place the form on as many locations as needed
(the use of element_builder.CreateForm(page) is illustrated in
ImpositionTest sample project - http://www.pdftron.com/pdfnet/samplecode.html#ImpositionTest).