SavePage Example VC++

This example shows how to save a page to a new file of the same file type and page type.  It also shows how to save the displayed page as a new, uncompressed BMP file at the displayed zoom factor.

void CImgEdit1Dlg::OnSavePage() 
{
    // Some examples of the SavePage method

    VARIANT evt; V_VT(&evt) = VT_ERROR; // set to default for saveas
    VARIANT vFileType; V_VT(&vFileType) = VT_I2; // set FileType for saveas
    VARIANT vPageType; V_VT(&vPageType) = VT_I2; // set PageType for saveas
    VARIANT vCompresionType; V_VT(&vCompresionType) = VT_I2; // set CompressionType
                                                             // for saveas
    VARIANT vCompresionInfo; V_VT(&vCompresionInfo) = VT_I2; // set CompressionInfo
                                                             // for saveas
    VARIANT vSaveAtZoom; V_VT(&vSaveAtZoom) = VT_BOOL; // set SaveAtZoom
                                                       // for saveas
    VARIANT vPageNumber; V_VT(&vPageNumber) = VT_I2; // set CompressionInfo
                                                     // for saveas
    // Save only the currently displayed page to a new file.  Keep file
    // type and page type the same as they were originally.  Use defaults
    // for file compression.  Save at original zoom factor.
    V_BOOL(&vSaveAtZoom) = FALSE;
    V_I2(&vPageNumber) = 1;
    ImgEdit1.SavePage ("D:\\image2\\savepage.tif", evt ,evt ,evt ,evt ,
     vSaveAtZoom, vPageNumber);
    
    // Save the currently displayed page to a new uncompressed color BMP file.
    // Save at the displayed zoom factor.
    V_I2(&vFileType) = 1;
    V_I2(&vPageType) = 1;
    V_I2(&vCompresionType) = 1;
    V_I2(&vCompresionInfo) = 0;
    V_BOOL(&vSaveAtZoom) = TRUE;
    V_I2(&vPageNumber) = 1;
    // wiFileTypeBMP, wiPageTypeBGR24, 1, 0, True, 1
    ImgEdit1.SavePage ("D:\\image2\\saved.bmp",vFileType,vPageType,vCompresionType,
     vCompresionInfo,vSaveAtZoom, vPageNumber);
}