Dear Heinz,
Thanks for your feedback.
Sorry there is no direct way to convert the specific pages from Word file to PDF file, but you can first convert the entire Word file to a PDF file, and then remove the pages that are not needed.
Sample code for reference.
- Code: Select all
Spire.Doc.Document doc = new Spire.Doc.Document();
doc.LoadFromFile(WordFile);
Stream pdfStream = new MemoryStream();
doc.SaveToStream(pdfStream, Spire.Doc.FileFormat.PDF);
Spire.Pdf.PdfDocument pdf = new Spire.Pdf.PdfDocument();
pdf.LoadFromStream(pdfStream);
int pageCount=pdf.Pages.Count;
for (int i = pageCount - 1; i > 4; i--)
{
pdf.Pages.RemoveAt(i);
}
pdf.SaveToFile(pdfFile);
Sincerely,
Amy
E-iceblue support team