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

Free Support Forum - aspose.com

Open specific pages and save

I have a word document with about 100 pages. Is thier a way to open a subset of the document by specifying the page numbers (for example pages 3 thru 6) as a new document. I then want to take that new document object(with only pages 3-6) and save it off as its own document.



Thanks for your request. MS Word document is flow document and does not contain any information about its layout into lines and pages. So there is no way to determine where page starts or ends and there is no way to split Word document into pages using Aspose.Words.

Currently, you can only extract a particular page of the document as an image, PDF or XPS document.

Best regards.

How woudl I go about extracting say page 3-6 of the document as a PDF? I have the aspose.total so I have access to the PDF libraries.


Thanks for your inquiry. You can use code like the following to extract 3-6 pages from Word document as PDF:

// Open document.

Document doc = new Document(@“Test001\in.doc”);

// Set start page index and pages count.

PdfSaveOptions opt = new PdfSaveOptions();

opt.PageIndex = 2;

opt.PageCount = 3;

// Save PDF.

doc.Save(@“Test001\out.pdf”, opt);

Hope this helps.

Best regards,

Thanks this seems to work on my local machine. However when I push the code out to our dev server it seems that the PDF pages do not match up exactly to the word doc pages? Does it have to do with the server not having office 2007 installed(which I have locally)?

The document we are pulling the pages from to convert to pdf is a .docx file.

As a complete test locally I saved my word doc(141 pages) as a PDF which came out to be 141 page. On the dev server running the same code the ouptut of the PDF is only 138 pages?

Does a different operatiing system on the server have something to do with it? Or the fact office isnt installed out there?


Thanks for your inquiry. The problem might occur because not all fonts that are installed on your local machine are also available on server. That is why layout of document can be different on local machine and on server.

You can just install fonts on server to fix the problem.

Best regards,