Deleting some pages from the document based on hidden text and merging new pages from different document

I want to delete some of the pages from the document-1 based on particular hidden text and then insert all pages from document-2 to document-1 at the same place where the last/final page was deleted.
From the attached OriginalDoc.doc, I want to delete some of the Signature pages(page No 4 and 5) which has the hidden text “WET_SIGN_PAGE” and insert/merge all the pages from DocTobeAppended.doc to OriginalDoc.doc before the Appendix A page where the last/final page was deleted.
The page numbers should be updated in the OrginalDoc.doc including newly inserted page accordingly. Please let me know how can I acheive this programatically.
You can verify the presense of hidden text “WET_SIGN_PAGE” in OriginalDoc.doc by checking the checkbox File->Options>Display-> Check the Hidden text

Hi Komal,

Thanks for your inquiry. You can achieve this using the following code snippet:

Document srcDoc = new Document(@"C:\Temp\OriginalDoc.doc");
Document finalDoc = (Document) srcDoc.Clone(true);
PageNumberFinder finder = new PageNumberFinder(srcDoc);
ArrayList pageSections = finder.RetrieveAllNodesOnPages(1, srcDoc.PageCount, NodeType.Section);
foreach(Section section in pageSections)
finalDoc.AppendChild(finalDoc.ImportNode(section, true));
finalDoc.Range.Replace(new Regex("WET_SIGN_PAGE"), new InsertDocumentAtReplaceHandler(), false);
private class InsertDocumentAtReplaceHandler: IReplacingCallback
    ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e)
        Document doc = (Document) e.MatchNode.Document;
        Document subDoc = new Document(@"C:\Temp\DocTobeAppended.doc");
        Paragraph para = (Paragraph) e.MatchNode.ParentNode;
        foreach(Section sec in subDoc.Sections)
        para.ParentSection.ParentNode.InsertAfter(doc.ImportNode(sec, true), para.ParentSection);
        return ReplaceAction.Skip;

Best regards,