Skip to main content
All docs
V24.2

PdfThumbnailsViewerSettings.GetSelectedThumbnailPageIndexes() Method

Obtains the indexes of the pages selected in the Page Thumbnails panel.

Namespace: DevExpress.Xpf.PdfViewer

Assembly: DevExpress.Xpf.PdfViewer.v24.2.dll

NuGet Package: DevExpress.Wpf.PdfViewer

Declaration

public IReadOnlyCollection<int> GetSelectedThumbnailPageIndexes()

Returns

Type Description
IReadOnlyCollection<Int32>

A collection of page indexes.

Remarks

The following example shows how to save only the pages of a PDF document selected in the Page Thumbnails panel as images:

using System.Windows.Media.Imaging;
using System.IO;
// ...
private void simpleButton_Click(object sender, RoutedEventArgs e) {
  // Obtains the selected page indexes.
  var pages = viewer.ActualThumbnailsViewerSettings.GetSelectedThumbnailPageIndexes();
  // Saves each page from the collection to an image.
  foreach (var i in pages) {
    BitmapSource image = viewer.CreateBitmap(i, 1000);
    PngBitmapEncoder encoder = new PngBitmapEncoder();
    encoder.Frames.Add(BitmapFrame.Create(image));
    using (var fileStream = new FileStream($"..\\MyBitmap{i + 1}.bmp", FileMode.Create)) {
        encoder.Save(fileStream);
    }
  }
}
See Also