AnnDeletePage example for C++ 5.0 and later
//This sample saves the annotations as the first page of a multipage annotation file
//The format is specified by the 'uFormat' parameter (either ANNFMT_NATIVE or ANNFMT_ENCODED)
//The annotations are flipped, and saved as the second page
//The annotations are rotated, and saved as the third page
//Information is displayed about the annotation file
//The second page is deleted, and information is again displayed about the annotation file
void CVCsampleLoadMemoryDlg::SampleAnnSave(CString strFileName, short uFormat)
{
int nRet;
char *pszFormat;
CString strMsg;
//Save as the first page of the annotation file
m_Lead1.AnnSave (strFileName, uFormat, FALSE, SAVE_OVERWRITE, 0);
//Flip the container, and save as the second page (insert before page 2)
m_Lead1.AnnFlip (TRUE, m_Lead1.GetBitmapHeight() / 2, FALSE);
m_Lead1.AnnSave(strFileName, uFormat, FALSE, SAVE_INSERT, 2);
//Rotate the container, and save as the third page
//Here we could pass the SAVE_INSERT flag and 3 for nPage,
//but instead we will use the SAVE_APPEND flag
m_Lead1.AnnRotate (FALSE, m_Lead1.GetBitmapWidth ()/ 2, m_Lead1.GetBitmapHeight()/ 2, 45, FALSE);
m_Lead1.AnnSave (strFileName, uFormat, FALSE, SAVE_APPEND, 0);
//Verify contents of file
nRet = m_Lead1.AnnFileInfo (strFileName);
if (nRet == 0)
{
switch(m_Lead1.GetAnnInfoFormat ())
{
case ANNFMT_NATIVE:
pszFormat = "ANNFMT_NATIVE";
break;
case ANNFMT_WMF:
pszFormat = "ANNFMT_WMF";
break;
case ANNFMT_ENCODED:
pszFormat = "ANNFMT_ENCODED";
break;
default:
pszFormat = "Unknown";
break;
}
strMsg.Format("File: %s\nFormat: %s\nVersion: %d\nTotal Pages: %d\n",
strFileName,
pszFormat,
m_Lead1.GetAnnInfoVersion (),
m_Lead1.GetAnnInfoTotalPages ()
);
MessageBox(strMsg);
}
else
{
MessageBox("Invalid Annotation File: " + strFileName);
}
//Now delete the second page, and display informtion
m_Lead1.AnnDeletePage(strFileName, 2);
//Verify contents of file
nRet = m_Lead1.AnnFileInfo(strFileName);
if (nRet == 0)
{
switch(m_Lead1.GetAnnInfoFormat ())
{
case ANNFMT_NATIVE:
pszFormat = "ANNFMT_NATIVE";
break;
case ANNFMT_WMF:
pszFormat = "ANNFMT_WMF";
break;
case ANNFMT_ENCODED:
pszFormat = "ANNFMT_ENCODED";
break;
default:
pszFormat = "Unknown";
break;
}
strMsg.Format("File: %s\nFormat: %s\nVersion: %d\nTotal Pages: %d\n",
strFileName,
pszFormat,
m_Lead1.GetAnnInfoVersion (),
m_Lead1.GetAnnInfoTotalPages ()
);
MessageBox(strMsg);
}
else
{
MessageBox("Invalid Annotation File: " + strFileName);
}
}