Aspose::Words::Saving::PageRange::PageRange constructor

PageRange::PageRange constructor

Creates a new page range object.

Aspose::Words::Saving::PageRange::PageRange(int32_t from, int32_t to)
ParameterTypeDescription
fromint32_tThe starting page zero-based index.
toint32_tThe ending page zero-based index. If it exceeds the index of the last page in the document, it is truncated to fit in the document on rendering.

Examples

Shows how to extract pages based on exact page ranges.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");

auto imageOptions = MakeObject<ImageSaveOptions>(SaveFormat::Tiff);
auto pageSet = MakeObject<PageSet>(MakeArray<SharedPtr<PageRange>>(
    {MakeObject<PageRange>(1, 1), MakeObject<PageRange>(2, 3), MakeObject<PageRange>(1, 3), MakeObject<PageRange>(2, 4), MakeObject<PageRange>(1, 1)}));

imageOptions->set_PageSet(pageSet);
doc->Save(ArtifactsDir + u"ImageSaveOptions.ExportVariousPageRanges.tiff", imageOptions);

See Also