using GemBox.Document; public static class GemBoxDocumentHelper { public static void AddWatermark(this Section section, string imagePath) { var doc = section.Document; // Create a Picture element for watermark. var watermarkPicture = new Picture(doc, imagePath); // Set Picture’s size to full page. watermarkPicture.Layout = new FloatingLayout( new HorizontalPosition(HorizontalPositionType.Absolute, HorizontalPositionAnchor.Page), new VerticalPosition(VerticalPositionType.Absolute, VerticalPositionAnchor.Page), new GemBox.Document.Size(section.PageSetup.PageWidth, section.PageSetup.PageHeight)) { WrappingStyle = TextWrappingStyle.BehindText }; // If default header exists add Picture element to it otherwise // add new default header with the Picture element. var header = section.HeadersFooters[HeaderFooterType.HeaderDefault]; if (header == null) section.HeadersFooters.Add( new HeaderFooter(doc, HeaderFooterType.HeaderDefault, new Paragraph(doc, watermarkPicture))); else header.Blocks.Add(new Paragraph(doc, watermarkPicture)); // Additionally check if first or even headers exist // in case they do add a copy of the Picture element. header = section.HeadersFooters[HeaderFooterType.HeaderFirst]; if (header != null) header.Blocks.Add(new Paragraph(doc, watermarkPicture.Clone())); header = section.HeadersFooters[HeaderFooterType.HeaderEven]; if (header != null) header.Blocks.Add(new Paragraph(doc, watermarkPicture.Clone())); } }