AnnDeletePage example for Delphi
{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}
Procedure TForm1.SampleAnnSave (strFileName: String; uFormat: Integer);
var
nRet: Integer;
strFormat: String;
strMsg: String;
begin
//Save as the first page of the annotation file
LEADAnn1.AnnSave (strFileName, uFormat, False, SAVE_OVERWRITE, 0);
//Flip the container, and save as the second page (insert before page 2)
LEADAnn1.AnnFlip (True, LEADAnn1.BitmapHeight / 2, False);
LEADAnn1.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
LEADAnn1.AnnRotate (False, LEADAnn1.BitmapWidth / 2, LEADAnn1.BitmapHeight / 2, 45, False);
LEADAnn1.AnnSave (strFileName, uFormat, False, SAVE_APPEND, 0);
//Verify contents of file
nRet:= LEADAnn1.AnnFileInfo (strFileName);
if (nRet = SUCCESS) Then
begin
Case LEADAnn1.AnnInfoFormat of
ANNFMT_NATIVE:
strFormat:= 'ANNFMT_NATIVE';
ANNFMT_WMF:
strFormat:= 'ANNFMT_WMF';
ANNFMT_ENCODED:
strFormat:= 'ANNFMT_ENCODED';
else
strFormat:= 'Unknown';
end;
strMsg := 'File: ' + strFileName + Chr(13);
strMsg := strMsg + 'Format: ' + strFormat + Chr(13);
strMsg := strMsg + 'Version: ' + IntToStr(LEADAnn1.AnnInfoVersion) + Chr(13);
strMsg := strMsg + 'Total Pages: ' + IntToStr(LEADAnn1.AnnInfoTotalPages) + Chr(13);
ShowMessage (strMsg);
end
else
ShowMessage ('Invalid Annotation File: ' + strFileName);
//Now delete the second page, and display information
LEADAnn1.AnnDeletePage (strFileName, 2);
//Verify contents of file
nRet := LEADAnn1.AnnFileInfo(strFileName);
if (nRet = SUCCESS) Then
begin
Case LEADAnn1.AnnInfoFormat of
ANNFMT_NATIVE: // Cut command.
strFormat := 'ANNFMT_NATIVE';
ANNFMT_WMF: // Copy command.
strFormat := 'ANNFMT_WMF';
ANNFMT_ENCODED: // Clear command.
strFormat := 'ANNFMT_ENCODED';
else
strFormat := 'Unknown';
end;
strMsg := 'File: ' + strFileName + Chr(13);
strMsg := strMsg + 'Format: ' + strFormat + Chr(13);
strMsg := strMsg + 'Version: ' + IntToStr(LEADAnn1.AnnInfoVersion) + Chr(13);
strMsg := strMsg + 'Total Pages: ' + IntToStr(LEADAnn1.AnnInfoTotalPages) + Chr(13);
ShowMessage (strMsg);
end
else
ShowMessage ('Invalid Annotation File: ' + strFileName);
end;