// Hook: AfterPowerPoint // Stamp every slide with a small footer text frame showing report name and // generation date. // // Presentations always carry provenance information even when downloaded or // forwarded. // // Aspose.Slides positions and sizes are in POINTS (72 per inch), as floats - // not EMU. Deriving the footer position from SlideSize keeps this correct on // 4:3 and 16:9 alike. There is no IShapeCollection.AddTextFrame; add an // auto-shape and give it a text frame. using System.Drawing; var stampText = $"{OutputName} - Generated {DateTime.Now:yyyy-MM-dd HH:mm}"; var slideWidth = Presentation.SlideSize.Size.Width; var slideHeight = Presentation.SlideSize.Size.Height; const float Margin = 20f; // ~0.28 inch const float FooterHeight = 18f; foreach (var slide in Presentation.Slides) { var shape = slide.Shapes.AddAutoShape( ShapeType.Rectangle, Margin, slideHeight - FooterHeight - Margin, slideWidth - (Margin * 2), FooterHeight); shape.FillFormat.FillType = FillType.NoFill; shape.LineFormat.FillFormat.FillType = FillType.NoFill; shape.AddTextFrame(stampText); var portion = shape.TextFrame.Paragraphs[0].Portions[0]; portion.PortionFormat.FontHeight = 8; portion.PortionFormat.FillFormat.FillType = FillType.Solid; portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Gray; } Logger.LogInformation($"Stamped footer on {Presentation.Slides.Count} slide(s).");