Free Support Forum - aspose.com

How can I convert pdf to word with custom pages

Hi,

I tried to find it in source, but I found nothing.
Any help?

Thanks.

@kngstr

Thank you for contacting support.

Please try the following code snippet in your environment and then share your kind feedback with us. It creates a word document containing specific pages and saves it as a DOCX file.

Document sourceDocument = new Document(dataDir + "Source.pdf");
Document pageDocument = new Document();
int[] pages = { 2,3,5 };
foreach (Page page in sourceDocument.Pages)
{
    foreach (int match in pages)
    {
        if (page.Number == match)
        {
            pageDocument.Pages.Add(page);
        }
    }
}
pageDocument.Save(dataDir + "Pages_19.11.docx" , SaveFormat.DocX);

@Farhan.Raza

I was trying to make my delphi version of c++ library
OK. It works fine.
Thanks.

@kngstr

Thank you for your kind feedback. Please feel free to contact us if you need any further assistance.