ComponentOne Xamarin Edition
Export
Controls > FlexViewer > Features > Export

FlexViewer allows you to export a PDF document and save it to a file, stream or as an image(s). You can use Save method of the FlexViewer class to save a PDF document to a file or a stream. In addition, you can use various methods provided by the FlexViewer class to save a PDF document as an image. These methods are listed in the following table:

Methods Description
SaveAsBmp Saves the document pages as images in BMP format, i.e., one image for each page.
SaveAsGif Saves the document pages as images in GIF format, i.e., one image for each page.
SaveAsJpeg Saves the document pages as images in JPEG format, i.e., one image for each page.
SaveAsPng Saves the document pages as images in PNG format, i.e., one image for each page.
SaveAsTiff Saves the document pages as images in TIFF format, i.e., one image for each frame.

The following code illustrates how to export PDF pages to images. This example uses the sample code created in Quick Start section.

C#
Copy Code
//Output range object which defines which pages of the document should be saved
OutputRange pageRange = new OutputRange(1, 2);

//Specify the options that should be used while saving the document's pages to image 
SaveAsImageOptions saveOptions = new SaveAsImageOptions()
{
    BackColor = Color.LightCyan,
    Resolution = 100
};

//Save image as png to a local system folder
flexViewer.SaveAsPng(Path.Combine(Environment.GetFolderPath(
    Environment.SpecialFolder.LocalApplicationData), "New{0}.png"), pageRange, saveOptions);