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# |
コードのコピー
|
|---|---|
//ドキュメントのどのページを保存するかを定義する出力範囲オブジェクト OutputRange pageRange = new OutputRange(1, 2); //ドキュメントのページを画像に保存するときに使用するオプションを指定します SaveAsImageOptions saveOptions = new SaveAsImageOptions() { BackColor = Color.LightCyan, Resolution = 100 }; //ローカルシステムフォルダにpngとして画像を保存します flexViewer.SaveAsPng(Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.LocalApplicationData), "New{0}.png"), pageRange, saveOptions); |
|