VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
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 encoders:
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 C#/VB.NET code that shows how to add images to an existing TIFF file synchronously:
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);
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)


Here is C#/VB.NET code that shows how to open TIFF file, rotate the second page of TIFF file and save changes in TIFF file:
// 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);
' 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)


Here is C#/VB.NET code that shows how to add images to a new PDF document asynchronously:
// ...
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 LLC.";
encoder.Settings.DocumentTitle = "My document title.";
encoder.Settings.DocumentCreator = "VintaSoft Imaging .NET SDK";
encoder.Settings.DocumentCreationDate = System.DateTime.Now;
images.SaveAsync("mydocument.pdf", encoder);
// ...

' ...
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 LLC."
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.