public override void Close()
{
if (close) {
return;
}
bool wasImage = (imageWait != null);
NewPage();
if (imageWait != null || wasImage) NewPage();
if (annotationsImp.HasUnusedAnnotations())
throw new Exception(MessageLocalization.GetComposedMessage("not.all.annotations.could.be.added.to.the.document.the.document.doesn.t.have.enough.pages"));
IPdfPageEvent pageEvent = writer.PageEvent;
if (pageEvent != null)
pageEvent.OnCloseDocument(writer, this);
base.Close();
writer.AddLocalDestinations(localDestinations);
CalculateOutlineCount();
WriteOutlines();
writer.Close();
}