GdPicture.NET Reference Guide
TiffMovePage Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : TiffMovePage Method
A unique image identifier of the GdPictureImage object representing the editable multipage TIFF image.
The page number of a required page you want to move. It must be a value from 1 to TiffGetPageCount.
The page number of a destination page. It must be a value from 1 to GetPageCount.
Moves a specified page to a destination page in an editable multipage TIFF image, that is represented by its unique image identifier.

Please note that this method only handles editable multipage TIFF images; otherwise it will fail.

Syntax
'Declaration
 
Public Function TiffMovePage( _
   ByVal ImageID As Integer, _
   ByVal PageNo As Integer, _
   ByVal Destination As Integer _
) As GdPictureStatus
public GdPictureStatus TiffMovePage( 
   int ImageID,
   int PageNo,
   int Destination
)
public function TiffMovePage( 
    ImageID: Integer;
    PageNo: Integer;
    Destination: Integer
): GdPictureStatus; 
public function TiffMovePage( 
   ImageID : int,
   PageNo : int,
   Destination : int
) : GdPictureStatus;
public: GdPictureStatus TiffMovePage( 
   int ImageID,
   int PageNo,
   int Destination
) 
public:
GdPictureStatus TiffMovePage( 
   int ImageID,
   int PageNo,
   int Destination
) 

Parameters

ImageID
A unique image identifier of the GdPictureImage object representing the editable multipage TIFF image.
PageNo
The page number of a required page you want to move. It must be a value from 1 to TiffGetPageCount.
Destination
The page number of a destination page. It must be a value from 1 to GetPageCount.

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.
Remarks
Be aware that this method only handles an editable multipage TIFF images. You can use the TiffIsEditableMultiPage method to check if a required image is an editable multipage TIFF image.

Likewise, for saving the provided modifications you need to use the TiffSaveMultiPageToFile(Int32,String,TiffCompression) method.

Example
How to move a page in the specified multipage TIFF image.
Dim caption As String = "Example: TiffMovePage"
Using oImage As GdPictureImaging = New GdPictureImaging()
    oImage.TiffOpenMultiPageForWrite(True)
    Dim imageID As Integer = oImage.TiffCreateMultiPageFromFile("multipage.tiff", True)
    If oImage.GetStat() = GdPictureStatus.OK Then
        If oImage.TiffIsEditableMultiPage(imageID) Then
            Dim compression As TiffCompression = oImage.GetTiffCompression(imageID)
            Dim pageCount As Integer = oImage.TiffGetPageCount(imageID)
            If oImage.GetStat() <> GdPictureStatus.OK Then GoTo Finished
        
            If oImage.TiffMovePage(imageID, 1, pageCount) <> GdPictureStatus.OK Then GoTo Finished
            If pageCount > 3 Then
                If oImage.TiffSwapPages(imageID, 2, 3) <> GdPictureStatus.OK Then GoTo Finished
            End If
            If oImage.TiffDeletePage(imageID, 1) <> GdPictureStatus.OK Then GoTo Finished
        
        Finished:
            If oImage.GetStat() = GdPictureStatus.OK Then
                If oImage.TiffSaveMultiPageToFile(imageID, "multipage.tiff", compression) = GdPictureStatus.OK Then
                    MessageBox.Show("Done!", caption)
                Else
                    MessageBox.Show("Error!    status: " + oImage.GetStat().ToString(), caption)
                End If
            Else
                MessageBox.Show("Error!    status: " + oImage.GetStat().ToString(), caption)
            End If
        Else
            MessageBox.Show("The specified image is not an editable multipage image.", caption)
        End If
        oImage.ReleaseGdPictureImage(imageID)
    Else
        MessageBox.Show("The image can't be created. Status: " + oImage.GetStat().ToString(), caption)
    End If
End Using
string caption = "Example: TiffMovePage";
using (GdPictureImaging oImage = new GdPictureImaging())
{
    oImage.TiffOpenMultiPageForWrite(true);
    int imageID = oImage.TiffCreateMultiPageFromFile("multipage.tiff", true);
    if (oImage.GetStat() == GdPictureStatus.OK)
    {
        if (oImage.TiffIsEditableMultiPage(imageID))
        {
            TiffCompression compression = oImage.GetTiffCompression(imageID);
            int pageCount = oImage.TiffGetPageCount(imageID);
            if (oImage.GetStat() != GdPictureStatus.OK) goto Finished;
 
            if (oImage.TiffMovePage(imageID, 1, pageCount) != GdPictureStatus.OK) goto Finished;
            if (pageCount>3)
                if (oImage.TiffSwapPages(imageID, 2, 3) != GdPictureStatus.OK) goto Finished;
            if (oImage.TiffDeletePage(imageID, 1) != GdPictureStatus.OK) goto Finished;
 
        Finished:
            if (oImage.GetStat() == GdPictureStatus.OK)
            {
                if (oImage.TiffSaveMultiPageToFile(imageID, "multipage.tiff", compression) == GdPictureStatus.OK)
                    MessageBox.Show("Done!", caption);
                else
                    MessageBox.Show("Error!    status: " + oImage.GetStat().ToString(), caption);
            }
            else
                MessageBox.Show("Error!    status: " + oImage.GetStat().ToString(), caption);
        }
        else
            MessageBox.Show("The specified image is not an editable multipage image.", caption);
        oImage.ReleaseGdPictureImage(imageID);
    }
    else
        MessageBox.Show("The image can't be created. Status: " + oImage.GetStat().ToString(), caption);
}
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
TiffIsEditableMultiPage Method
TiffOpenMultiPageForWrite Method
TiffCreateMultiPageFromFile(String) Method
TiffCreateMultiPageFromGdPictureImage Method
TiffSaveMultiPageToFile(Int32,String,TiffCompression) Method
TiffDeletePage Method
TiffSwapPages Method