TiffSelectPage Method (GdPictureImaging)
In This Topic
Selects a required page in the specified multipage TIFF image represented by its unique image identifier. The defined page is selected for further use, which means, that the page can be edited or saved to a different file.
This method only handles multipage TIFF images, both editable or opened as read-only.
Syntax
Parameters
- ImageID
- A unique image identifier of the GdPicture image representing the multipage TIFF image.
- Page
- The page number of a page you want to select. It must be a value from 1 to TiffGetPageCount.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
Example
Removing the blank pages from a tiff document.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// LoadInMemory parameter is set to true in order to be able to update the input file.
int imageID = gdpictureImaging.TiffCreateMultiPageFromFile("multipage.tif", true);
int pageCount = gdpictureImaging.TiffGetPageCount(imageID);
int pageNo = 1;
while (pageNo <= pageCount)
{
gdpictureImaging.TiffSelectPage(imageID, pageNo);
if (gdpictureImaging.IsBlank(imageID))
{
gdpictureImaging.TiffDeletePage(imageID, pageNo);
pageCount--;
}
else
{
pageNo++;
}
}
gdpictureImaging.TiffSaveMultiPageToFile(imageID, "multipage.tif", TiffCompression.TiffCompressionAUTO);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Example
Removing the blank pages from a tiff document.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// LoadInMemory parameter is set to true in order to be able to update the input file.
int imageID = gdpictureImaging.TiffCreateMultiPageFromFile("multipage.tif", true);
int pageCount = gdpictureImaging.TiffGetPageCount(imageID);
int pageNo = 1;
while (pageNo <= pageCount)
{
gdpictureImaging.TiffSelectPage(imageID, pageNo);
if (gdpictureImaging.IsBlank(imageID))
{
gdpictureImaging.TiffDeletePage(imageID, pageNo);
pageCount--;
}
else
{
pageNo++;
}
}
gdpictureImaging.TiffSaveMultiPageToFile(imageID, "multipage.tif", TiffCompression.TiffCompressionAUTO);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also