Copy layers (OCGs) from one PDF to another

I am using PDFNet 4.8.0.0 and am trying to preserve layers when exporting pages from one PDF to another. Through my current process, when I copy a page from a source PDF that has layers to a new PDF document, the layers are lost.

After referencing topics like the ones below, I am still unable to successfully copy layers:

http://www.pdftron.com/pdfnet/samplecode/PDFLayers.cs
https://groups.google.com/forum/#!topic/pdfnet-sdk/dli_LNY9zGIhttps://groups.google.com/forum/#!topicsearchin/pdfnet-sdk/layers/pdfnet-sdk/Q6qbzbGsiA4

My code is posted below. While I can read the layers from the source PDF, my results are the same. The page is copied, but the layers are lost. If anyone can point me in the right direction, I would greatly appreciate it. Thanks!


using (PDFDoc indoc = new PDFDoc(@“C:\Temp\input.pdf”))
{
if (indoc.HasOC())
{

Page page = indoc.GetPage(1);

Obj props = page.GetResourceDict().FindObj(“Properties”);

DictIterator itrPage = props.GetDictIterator();

Group g;
string name;

PDFDoc outDoc = new PDFDoc();

Page outPage = outDoc.PageCreate();

Obj value;

while (itrPage.HasNext())
{
value = itrPage.Value();

g = new Group(value);
outDoc.GetSDFDoc().ImportObj(g.GetSDFObj(), true);

if (g.IsValid())
{
name = g.GetName();
Console.WriteLine(name);
}

itrPage.Next();
}

outDoc.PagePushBack(page);

PDFDocViewPrefs prefs = outDoc.GetViewPrefs();
prefs.SetPageMode(PDFDocViewPrefs.PageMode.e_UseOC);

outDoc.Save(@“C:\Temp\outpdf3.pdf”, SDFDoc.SaveOptions.e_linearized);
outDoc.Close();
}