Thanks for the update! I used the code you provided, but the page count of first page after splitting is still 2, and output file 000.docx has 2 pages. Then I realized I loaded document from stream, when I changed it to loading from a .html file like your code, page count is still 2, but output file has only 1 page, which is strange too. However, the final print still has additional blank page.
But either way, I’m getting pageCount = 2 from Splitter.GetDocumentOfPage(1), which I think should be 1, right?
public void CreatePrintFiles(string asHTMLText, string asXpsPath)
// Save inbound HTML to file
string lsXpsFileNoExt = asXpsPath.Substring(0, asXpsPath.Length - 4);
loWriter = new System.IO.StreamWriter(lsXpsFileNoExt + ".html", true, Encoding.UTF8);
// Create document from HTML text
byte laHTML = Encoding.UTF8.GetBytes(asHTMLText);
MemoryStream loStream = new MemoryStream(laHTML);
loStream.Position = 0;
//Aspose.Words.Document loDoc = new Aspose.Words.Document(loStream, new Aspose.Words.HtmlLoadOptions()); // load from stream
Aspose.Words.Document loDoc = new Document(lsXpsFileNoExt + ".html", new Aspose.Words.HtmlLoadOptions()); //load from saved file