PageSet class

PageSet class

Describes a random set of pages. To learn more, visit the Programming with Documents documentation article.

Constructors

NameDescription
PageSet(page)Creates an one-page set based on exact page index.
PageSet(pages)Creates a page set based on exact page indices.
PageSet(ranges)Creates a page set based on ranges.

Properties

NameDescription
allGets a set with all the pages of the document in their original order.
evenGets a set with all the even pages of the document in their original order.
oddGets a set with all the odd pages of the document in their original order.

Examples

Shows how to render one page from a document to a JPEG image.

doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
builder.writeln('Page 1.')
builder.insert_break(aw.BreakType.PAGE_BREAK)
builder.writeln('Page 2.')
builder.insert_image(file_name=IMAGE_DIR + 'Logo.jpg')
builder.insert_break(aw.BreakType.PAGE_BREAK)
builder.writeln('Page 3.')
# Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
# to modify the way in which that method renders the document into an image.
options = aw.saving.ImageSaveOptions(aw.SaveFormat.JPEG)
# Set the "PageSet" to "1" to select the second page via
# the zero-based index to start rendering the document from.
options.page_set = aw.saving.PageSet(page=1)
# When we save the document to the JPEG format, Aspose.Words only renders one page.
# This image will contain one page starting from page two,
# which will just be the second page of the original document.
doc.save(file_name=ARTIFACTS_DIR + 'ImageSaveOptions.OnePage.jpg', save_options=options)

See Also