private static void ReceiveWarningNotification(Document doc, string dataDir)
{
// ExStart:ReceiveWarningNotification
// When you call UpdatePageLayout the document is rendered in memory. Any warnings that occured during rendering
// Are stored until the document save and then sent to the appropriate WarningCallback.
doc.UpdatePageLayout();
// Create a new class implementing IWarningCallback and assign it to the PdfSaveOptions class.
HandleDocumentWarnings callback = new HandleDocumentWarnings();
doc.WarningCallback = callback;
dataDir = dataDir + "Rendering.FontsNotificationUpdatePageLayout_out.pdf";
// Even though the document was rendered previously, any save warnings are notified to the user during document save.
doc.Save(dataDir);
// ExEnd:ReceiveWarningNotification
}
// ExStart:HandleDocumentWarnings