Skip to main content linkedinfacebooktwittermenuarrow-up
1

Convert specified Pages from Word doc to PDF Completed

Hi I think it would be great if we could specify the pages to convert, for example if I could specify the start index and the amount of pages, or just an array of page numbers.

Currently I save the pages one at a time then merge them afterwords.

Official response

Mario at GemBox

Hi,
This feature request has been implemented and is available in the latest versions of GemBox.Document.
To save a range of pages from Word document to PDF, use this:

var document = DocumentModel.Load("Input.docx");
var paginator = document.GetPaginator();
paginator.GetRange(1, 3).Save("Output.pdf");

Regards,
Mario

Comment (1)

Mario at GemBox
Hi Mauritz, Currently, that feature is available only in PrintOptions class (with ToPage and FromPage properties). So, perhaps for now, another workaround would be to print the document with some virtual printer and specify the desired PrintOptions. Nevertheless, I believe that your current approach (saving the desired pages to PDF and then merging them after, is better. Regards, Mario