Split Multipage Tiff Document

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
Posts: 10
Joined: Mon Oct 30, 2017 11:16 pm

Split Multipage Tiff Document

Post by rstrickland1958 » Mon Nov 27, 2017 10:39 pm

The user needs to be able to split a multipage document by selecting specific pages from the thumbnail viewer and save the selected images to a new document and save the unselected pages to another new document. I have the selected thumbnail collection coming back with the selected images but I am missing how to compare that to the original images collection so that I can go through the collection and adjust the pages based on the selection. Below is my sample code after the user selects 'Split':

Code: Select all

sourceStream = new FileStream(this.MainView.DocumentPath, FileMode.Open);
string newPath = $"{Path.GetDirectoryName(this.MainView.DocumentPath)}\\.strickland.tif";
newStream = new FileStream(newPath, FileMode.CreateNew);

var sourceTest = new TiffFile(this.MainView.DocumentPath);
var destTest = new TiffFile((newPath));

// Save for new document with selected pages
var tiffEncoder = new TiffEncoder(true);
foreach (ThumbnailImageItem page in this.MainView.ThumbnailViewerMain.SelectedThumbnails)
    tiffEncoder.SaveImage(page.Source, newStream);
The above compiles but the page.Source is null. Is there property off the ThumbnailImageItem that tells me which index the image represents in the images collection? Or some other setting that gives the index location of the selected images. Is there another direction that I should be looking at?

Site Admin
Posts: 1491
Joined: Thu Jul 10, 2008 2:21 pm

Re: Split Multipage Tiff Document

Post by Alex » Tue Nov 28, 2017 9:51 am


The VintasoftImage.SourceInfo property allows to get information (source filename, page index, etc) about image:
https://www.vintasoft.com/docs/vsimagin ... eInfo.html

Please use information about image for sorting images in image collection and let me know if you will have any question or problem.

Best regards, Alexander

Post Reply