This example demonstrates how to replace a single page in a file.
void CAdmin1Dlg::OnReplace()
{
CString strOrigFile, strReplaceFile;
// Use the dialog box to pick the original file.
ImgAdmin1.SetDialogTitle ("Select the original file");
VARIANT vhWnd; V_VT(&vhWnd) = VT_I4;
V_I4(&vhWnd) = (long)m_hWnd;
ImgAdmin1.ShowFileDialog (0,vhWnd); // OpenDlg
// Because we are using the dialog box to pick the file to
// be used for replace, we need to save the original file.
strOrigFile = ImgAdmin1.GetImage();
ImgAdmin1.SetDialogTitle ("Select the file to be used
for the replace");
ImgAdmin1.ShowFileDialog (0,vhWnd); // OpenDlg
strReplaceFile = ImgAdmin1.GetImage();
// Restore the original filename to the Image property because
// the property must contain the destination file name.
ImgAdmin1.SetImage (strOrigFile);
// You are going to replace 1 page page 4
// in original file will be replaced by page 2 of the source
// file. The compression type of the source file will be
// retained since a different compression type is not specified.
VARIANT evt;
evt.vt = VT_ERROR; // set to error for optional parameter
ImgAdmin1.Replace (strReplaceFile, 2, 4, 1, evt, evt);
}