How do I add an image as a background layer?

How do I add an image to an existing page as a background layer? I use
C++ (C# is fine as well).
the simplest approach is as follows:

void AddLogoToEachPage(string origPDFLocation, string fileName, string
eBookPath, string logoPath)

   PDFDoc doc("d:/life.pdf");

   Page page;
   int pages = doc.GetPagesCount();

   ElementWriter writer;
   ElementReader reader;
   ElementBuilder eb;
   Element* element;
   for (int i = 1; i <= pages; ++i) {
      PageIterator itr = doc.PageFind(i);
      if (itr != doc.PageEnd()) {
         page = *itr;
         writer.Begin(page, true, false);
         Image img = Image::Create(doc, logoPath.c_str());
         element = eb.CreateImage(img, Common::Matrix2D(100, 0, 0, 50,
20, 50));
   doc.Save("d:/out.pdf", Doc::e_remove_unused, 0);