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

Free Support Forum - aspose.com

Save individual pages of document


I've recently started using Aspose.Words and have been able to get a file from a database, perform a mail merge and save as a pdf.

What I would like to be able to do is once I've done the mail merge is then save each individual page of the document as a pdf into the database - is there a way to loop through each page of the word document after the mail merge and then save each page individually?



Hi Cliff,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Please try using the following code to achieve what you need:

//Open document.

Document doc = new Document("in.doc");

for (int i=0; i< doc.PageCount; i++)

doc.SaveToPdf(i, 1, String.Format("Page{0}.pdf", i), null);

Best regards,

Cheers Andrey - that looks like it will do what I need, I’ll test and confirm :slight_smile: