VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
Vintasoft.Imaging Namespace / ImageCollection Class / SaveSync Methods / SaveSync(String,Boolean) Method
Syntax Exceptions Remarks Example Requirements SeeAlso
In This Topic
    SaveSync(String,Boolean) Method (ImageCollection)
    In This Topic
    Saves synchronously all images from this collection to specified multipage image (JBIG2/PDF/TIFF) file.
    Syntax
    'Declaration
    
    Public Overloads Sub SaveSync( _
    ByVal filename
    Filename where the image collection should be saved.
    As System.String, _
    ByVal createNewFile
    A value indicating whether a new file should be created.
    As Boolean _
    )
    public void SaveSync(
    System.String filename,
    bool createNewFile
    )
    public: void SaveSync(
    System.String filename,
    bool createNewFile
    )
    public:
    void SaveSync(
    System.String filename,
    bool createNewFile
    )

    Parameters

    filename
    Filename where the image collection should be saved.
    createNewFile
    A value indicating whether a new file should be created.
    Exceptions
    ExceptionDescription
    Thrown if filename is null.
    Thrown if image collection does not contain images or another saving process is executing at this moment.
    Thrown if encoder is not found for specified file extension or error occurs at saving the image.
    Remarks

    This method works synchronously.

    Supported image formats: JBIG2, PDF, TIFF.

    Suitable encoder is selected automatically from the extension of the filename, exception is thrown if encoder is not found for file extension specified in filename.

    This method

    • saves images to new JBIG2/PDF/TIFF file specified by filename
    • file specified by filename is overwritten if it exists
    • saving process can be canceled, saving of images can be suppressed
    • sources of images in the image collection are not changed, i.e. images[i].SourceInfo.Filename is not changed
    if
    • filename != images[0]..SourceInfo.Filename
    • SaveAndSwitchSource is false
    • createNewFile is true

    This method
    • adds images to existing JBIG2/PDF/TIFF file specified by filename
    • saving process can be canceled, saving of images can be suppressed
    • sources of images in the image collection are not changed, i.e. images[i].SourceInfo.Filename is not changed
    if
    • filename != images[0]..SourceInfo.Filename
    • SaveAndSwitchSource is false
    • createNewFile is false

    This method
    • saves images to new JBIG2/PDF/TIFF file specified by filename
    • file specified by filename is overwritten if it exists, value of the createNewFile parameter is ignored
    • saving process cannot be canceled, saving of images cannot be suppressed
    • sources of images in the image collection are changed, i.e. images[i].SourceInfo.Filename is changed to filename
    if
    This method
    • changes images in the source JBIG2/PDF/TIFF file if some images of source file are changed in the image collection
    • removes images from the source JBIG2/PDF/TIFF file if some images of source file are removed from the image collection
    • adds images to the source JBIG2/PDF/TIFF file if some images of NOT from the source file are added to the image collection
    • reindex images in the source JBIG2/PDF/TIFF file if images are reindexed in the image collection
    • file specified by filename is overwritten if it exists, value of the createNewFile parameter is ignored
    • saving process cannot be canceled, saving of images cannot be suppressed
    • sources of images in the image collection is changed, i.e. images[i].SourceInfo.Filename is changed to filename
    if
    This method
    • throw an exception
    if
    ImageSaving event will occur before saving of each image. In this event you can get information about the image, suppress image saving or cancel image saving process.
    ImageSaved event will occur after saving of each image. In this event you can get information about progress of images saving process or cancel image saving process.

    Example

    This example illustrates how to save the image collection synchronously.

    
    ' save image collection to a TIFF file
    ' file will be overwritten if it exists
    imageViewer1.Images.SaveSync("new-file-name.tif", True)
    
    
    
    // save image collection to a TIFF file
    // file will be overwritten if it exists
    imageViewer1.Images.SaveSync("new-file-name.tif", true);
    
    

    Requirements

    Target Platforms: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also