Experiencing the following issues attempting to place text and background image watermarks with Spire.Pdf 5.1.4.2046:
1. Text and background image watermarks do not appear on some pages in pdf document (usually pages with drawings).
2. When attempting to add background image watermarks to some pages (with drawings), the background image is not visible and the original page content is not rendered properly (only half the page is rendered).
Implementation:
Image image = Image.FromFile(@"Logo.PNG");
foreach (PdfPageBase page in document.Pages)
{
// add image
page.BackgroundImage = image;
page.BackgroudOpacity = 0.1f;
// add text
PdfTilingBrush brush = new PdfTilingBrush(new SizeF(page.Canvas.ClientSize.Width / 2, page.Canvas.ClientSize.Height / 3));
brush.Graphics.SetTransparency(0.1f);
brush.Graphics.Save();
brush.Graphics.TranslateTransform(brush.Size.Width / 2, brush.Size.Height / 2);
brush.Graphics.RotateTransform(-45);
brush.Graphics.DrawString("CONTROLLED COPY", new PdfFont(PdfFontFamily.Helvetica, 24), PdfBrushes.Red, 0, 0, new PdfStringFormat(PdfTextAlignment.Center));
brush.Graphics.Restore();
brush.Graphics.SetTransparency(0.1f);
page.Canvas.DrawRectangle(brush, new RectangleF(new PointF(0, 0), page.Canvas.ClientSize.ToSize()));
}