even property

PageSet.even property

Gets a set with all the even pages of the document in their original order.

get even(): Aspose.Words.Saving.PageSet

Remarks

Even pages have odd indices since page indices are zero-based.

Examples

Shows how to export Odd pages from the document.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

for (let i = 0; i < 5; i++)
{
  builder.writeln(`Page ${i + 1} (${(i % 2 == 0 ? "odd" : "even")})`);
  if (i < 4)
    builder.insertBreak(aw.BreakType.PageBreak);
}

// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
let options = new aw.Saving.PdfSaveOptions();

// Below are three PageSet properties that we can use to filter out a set of pages from
// our document to save in an output PDF document based on the parity of their page numbers.
// 1 -  Save only the even-numbered pages:
options.pageSet = aw.Saving.PageSet.even;

doc.save(base.artifactsDir + "PdfSaveOptions.ExportPageSet.even.pdf", options);

// 2 -  Save only the odd-numbered pages:
options.pageSet = aw.Saving.PageSet.odd;

doc.save(base.artifactsDir + "PdfSaveOptions.ExportPageSet.odd.pdf", options);

// 3 -  Save every page:
options.pageSet = aw.Saving.PageSet.all;

doc.save(base.artifactsDir + "PdfSaveOptions.ExportPageSet.all.pdf", options);

See Also