PDFsharp & MigraDoc Foundation http://forum.pdfsharp.com/ |
|
Page becomes black after editing PDF http://forum.pdfsharp.com/viewtopic.php?f=3&t=4282 |
Page 1 of 1 |
Author: | VladimirZiniakov [ Fri Aug 13, 2021 12:21 pm ] |
Post subject: | Page becomes black after editing PDF |
Hello, I have a problem with adding watermarks to some PDF's. While the code below adds them correctly, the whole page becomes black after it. The links for both the source and the result files are below. Please advise on this bug. https://www.dropbox.com/s/ol8pju00n751k ... e.pdf?dl=0 https://www.dropbox.com/s/4t2zkn9fst81m ... n.pdf?dl=0 Code: public class PdfMaker
{ public void CopyPdf(string source, string destination) { var bytes = File.ReadAllBytes(source); bytes = AddWatermarksToPdf(bytes); File.WriteAllBytes(destination, bytes); } private byte[] AddWatermarksToPdf(byte[] pdfBytes) { var pdf = new PdfWrapper(pdfBytes); var watermarkText = "Hello, World!"; var watermarks = new[] { new PdfWatermark { Text = watermarkText, Coordinates = new Point(25, 100), Angle = 90, BrushColor = Color.Black, Font = new Font("Arial", 4, FontStyle.Regular, GraphicsUnit.World) }, new PdfWatermark { Text = watermarkText, Coordinates = new Point(5, 200), Angle = 90, BrushColor = Color.White, Font = new Font("Arial", 1, FontStyle.Regular, GraphicsUnit.World) } }; pdf.AddWaterMark(watermarks); return pdf.ToArray(); } } |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |