VintaSoft Imaging .NET SDK v8.7
In This Topic
    Save image collection
    In This Topic

    ImageCollection.SaveSync method can be used for synchronous saving of image collection to a file or stream.
    ImageCollection.SaveAsync method can be used for asynchronous saving of image collection to a file or stream.

    Here is a list of supported image formats:


    Encoder passed as a method parameter defines saving parameters: save image with annotations, save to the same source, copy TIFF tags, copy EXIF data and much more.


    Here is an example that shows how to add images to an existing TIFF file synchronously:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    Dim images As New Vintasoft.Imaging.ImageCollection()
    images.Add("myimage1.png")
    images.Add("myimage2.jpg")
    
    ' add images to an existing TIFF file
    Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.TiffEncoder(False)
    images.SaveSync("mydocument.tif", encoder)
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    Vintasoft.Imaging.ImageCollection images = 
        new Vintasoft.Imaging.ImageCollection();
    images.Add("myimage1.png");
    images.Add("myimage2.jpg");
    
    // add images to an existing TIFF file
    Vintasoft.Imaging.Codecs.Encoders.TiffEncoder encoder = 
        new Vintasoft.Imaging.Codecs.Encoders.TiffEncoder(false);
    images.SaveSync("mydocument.tif", encoder);
                    
    


    Here is an example that shows how to open TIFF file, rotate the second page of TIFF file and save changes in TIFF file:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    
    ' open TIFF file
    Dim fStream As New System.IO.FileStream("multipage.tif", System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite)
    Dim images As New Vintasoft.Imaging.ImageCollection()
    images.Add(fStream)
    
    ' rotate the second page of TIFF file
    images(1).Rotate(90)
    
    ' save changes to TIFF file
    Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.TiffEncoder()
    encoder.SaveAndSwitchSource = True
    images.SaveSync(fStream, encoder)
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    
    // open TIFF file
    System.IO.FileStream fStream = new System.IO.FileStream(
        "multipage.tif", System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
    Vintasoft.Imaging.ImageCollection images = 
        new Vintasoft.Imaging.ImageCollection();
    images.Add(fStream);
    
    // rotate the second page of TIFF file
    images[1].Rotate(90);
    
    // save changes to TIFF file
    Vintasoft.Imaging.Codecs.Encoders.TiffEncoder encoder = 
        new Vintasoft.Imaging.Codecs.Encoders.TiffEncoder();
    encoder.SaveAndSwitchSource = true;
    images.SaveSync(fStream, encoder);
                    
    


    Here is an example that shows how to add images to a new PDF document asynchronously:
    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Imaging
    ' - Vintasoft.Imaging.Pdf
    
    ' ...
    Dim images As New Vintasoft.Imaging.ImageCollection()
    images.Add("myimage1.png")
    images.Add("myimage2.jpg")
    
    ' create new PDF document
    Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(True)
    encoder.Settings.DocumentAuthor = "VintaSoft Ltd."
    encoder.Settings.DocumentTitle = "My document title."
    encoder.Settings.DocumentCreator = "VintaSoft Imaging .NET SDK"
    encoder.Settings.DocumentCreationDate = System.DateTime.Now
    images.SaveAsync("mydocument.pdf", encoder)
    ' ...
    
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Imaging
    // - Vintasoft.Imaging.Pdf
    
    // ...
    Vintasoft.Imaging.ImageCollection images = 
        new Vintasoft.Imaging.ImageCollection();
    images.Add("myimage1.png");
    images.Add("myimage2.jpg");
    
    // create new PDF document
    Vintasoft.Imaging.Codecs.Encoders.PdfEncoder encoder = 
        new Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(true);
    encoder.Settings.DocumentAuthor = "VintaSoft Ltd.";
    encoder.Settings.DocumentTitle = "My document title.";
    encoder.Settings.DocumentCreator = "VintaSoft Imaging .NET SDK";
    encoder.Settings.DocumentCreationDate = System.DateTime.Now;
    images.SaveAsync("mydocument.pdf", encoder);
    // ...
    
                    
    


    Events

    ImageCollection.ImageCollectionSaving event occurs before image collection is saving.

    For each image of image collection: ImageCollection.ImageCollectionSavingFinished event occurs the image collection saving process is finished.

    ImageCollection.ImageCollectionSaved event occurs when the image collection is successfully saved.


    All events of the Vintasoft.Imaging.ImageCollection class are not thread-safe.