byte[] docData = docViewer.ExportToPdfWatermark("Watermark Text", 24, System.Drawing.Color.Red, 45, 50, true);
docViewer.CloseDocument();
return new FileContentResult(docData, "application/pdf");
It works fine when I changed the opacity to 50 and isbackground to false
byte[] docData = docViewer.ExportToPdfWatermark("Watermark Text", 24, System.Drawing.Color.Red, 45, 50, false);
docViewer.CloseDocument();
return new FileContentResult(docData, "application/pdf");
This is the solution you came up with, I am posting it here for future reference.
byte[] file = attachment.Data.FileData;
Stream stream = new MemoryStream(file);
FileInfo fi = new FileInfo(attachment.Data.FileName);
var viewToken = docViewer.OpenDocument(stream, fi, config, documentOptions);
byte[] docData = docViewer.ExportToPdfWatermark("watermark text", 24, System.Drawing.Color.Red, 45, 50, false);
docViewer.CloseDocument();
return new FileContentResult(docData, "application/pdf");
1 Like