←Select platform

SaveAsync(RasterImage,Stream,RasterImageFormat,int,int,int,int,CodecsSavePageMode,object) Method

Summary

Asynchronously saves one or more pages of a RasterImage to a stream in any of the supported compressed or uncompressed formats asynchronously.

Syntax

C#
VB
Objective-C
C++

Public Sub SaveAsync( 
   ByVal image As RasterImage, 
   ByVal stream As System.IO.Stream, 
   ByVal format As RasterImageFormat, 
   ByVal bitsPerPixel As Integer, 
   ByVal firstPage As Integer, 
   ByVal lastPage As Integer, 
   ByVal firstSavePageNumber As Integer, 
   ByVal pageMode As CodecsSavePageMode, 
   ByVal userState As Object 
) 

public:  
   void SaveAsync( 
       RasterImage^ image, 
      System::IO::Stream^ stream, 
      RasterImageFormat^ format, 
      int bitsPerPixel, 
      int firstPage, 
      int lastPage, 
      int firstSavePageNumber, 
      CodecsSavePageMode^ pageMode, 
      Object^ userState 
   ) 

- (void)saveAsync:(LTRasterImage *)image 
stream:(LTLeadStream *)stream 
format:(LTRasterImageFormat)format 
bitsPerPixel:(NSInteger)bitsPerPixel 
firstPage:(NSInteger)firstPage 
lastPage:(NSInteger)lastPage 
firstSavePageNumber:(NSInteger)firstSavePageNumber 
pageMode:(LTCodecsSavePageMode)pageMode 
completion:(void (^)(NSError * __nullable error))completion 

Parameters

image

The RasterImage object that holds the image data.

stream

The System.IO.Stream where the image data will be saved.

format

The output file format. For valid values, refer to

Summary of All Supported Image File Formats.

bitsPerPixel

Resulting file's pixel depth. Note that not all bits per pixel are

available to all file formats. For valid values, refer to Summary of All Supported Image File Formats. If

bitsPerPixel is 0, the image will be stored using the closest bits per pixel value supported by that format. For example, if a file format supports 1-, 4-, and 24-bits per pixel, and RasterImage.BitsPerPixel is 5, the file will be stored as 24-bit. Likewise, if RasterImage.BitsPerPixel is 2, the file will be stored as 4-bit.

firstPage

1-based index of the first page in image to save.

lastPage

1-based index of the last page in image to save. Pass -1 to save from

firstPage to the last page in image.

firstSavePageNumber

1-based index of the first output page. If the output file already exists, then this

parameter lets you control which pages to overwrite and/or where to append the new pages.

pageMode

Determines how to handle the page when saving to multi-page formats. The following values are possible:

Value Meaning
CodecsSavePageMode.Append Append the new page(s) to the end of the file. If the file does not exist, this option will create the file and add the pages to it. firstSavePageNumber is not used.
CodecsSavePageMode.Insert Insert the new page(s) at the index specified by firstSavePageNumber.
CodecsSavePageMode.Replace Replace the page(s) starting at the index specified by firstSavePageNumber.
CodecsSavePageMode.Overwrite Overwrite the page(s) starting at the index specified by firstSavePageNumber.

userState

A user-defined object that is passed to the method invoked when the asynchronous operation completes.

Remarks

NOTE: This topic is part of RasterCodecs Async support using the .NET System.ComponentMode.AsyncOperation model. For .NET async/await, use Task<bool> SaveAsync(RasterImage image, ILeadStream stream, RasterImageFormat format, int bitsPerPixel, int firstPage, int lastPage, int firstSaveNumber, CodecsSavePageMode pageMode).

The SaveAsyncCompleted event will occur when the RasterCodecs finishes saving the image.

For general information on saving images using RasterCodecs, refer to Save.

Requirements

Target Platforms

Help Version 20.0.2018.6.21
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Codecs Assembly