Free Support Forum -

How can I convert the first page of a Word.doc to PDF?

I have a lot of large word documents, and I want to
convert the first page of each *.doc file to PDF.

With this code using Aspose.Word&Pdf for .Net,
I get all pages converted to PDF:

Aspose.Words.Document doc = new Document(docFileName);
doc.Save(stream, SaveFormat.AsposePdf);
stream.Seek(0, SeekOrigin.Begin);
XmlDocument xmlDocument = new XmlDocument();
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(xmlDocument, null);

Is there any way of extracting only the first page ?
I’ll appreciate your effort very much, if you provide us
something like this:

pdf.EndPage = 1;

Thank you.



Thank you for considering Aspose.

Extraction of one page is not supported in Aspose.Words, you can ask directly Aspose.Words team if they can support it.

For a workaround what you can do is you need to have Aspose.Pdf.Kit as well. The steps would be like:

1. Convert word document to Pdf using Aspose.Pdf and Aspose.Words

2. Extract first page from PDF using Aspose.Pdf.Kit

If you need more help, please do let us know.