We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cannot find PageNumberFinder in Aspose.Words 22.3.0


I am trying to copy cover page from a template document and according to samples I found online I should use PageNumberFinder class.
I am using Aspose.Words 22.3.0 witn .NET 6, but it seems like PageNumberFinder is nowhere to be found :slight_smile:
Is there a specific namespace where it sites or it is deprecated? If so, what can I use instead to copy cover page from template to new target document?

@dejanstojanovic If you would like to find a page number of some particular node in the document, you can use LayoutCollector class.
If you need to copy some particular page into another document, you can use Document.ExtractPages method to achieve this. For example the following code copies the first page of one document into another.

// Open Source and destination documents.
Document src = new Document(@"C:\Temp\src.docx");
Document dst = new Document(@"C:\Temp\dst.docx");

// Extract the first page of the source document.
Document firstPage = src.ExtractPages(0, 1);

// Append the dst document to the first page document.
firstPage.AppendDocument(dst, ImportFormatMode.KeepSourceFormatting);

// Save the result.

This works perfect, thanks

1 Like