Copy layers (OCGs) from one PDF to another

I am using PDFNet 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:!topic/pdfnet-sdk/dli_LNY9zGI!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();



PDFDocViewPrefs prefs = outDoc.GetViewPrefs();

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