I tried IronPdf’s PdfDocument.ApplyWatermark(watermarkHtml), but it din’t work, no watermark is appied. You guys know any other library or workarounds? I’m using Dotnet 6 and IronPdf 2023.5.8
IronPdf.Logging.Logger.EnableDebugging = true;
IronPdf.Logging.Logger.LogFilePath = "Default.log"; //May be set to a directory name or full file
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;
Installation.LinuxAndDockerDependenciesAutoConfig = false;
Installation.Initialize();
HttpResponseMessage stream = await this.httpClient.GetAsync("https://test2134.blob.core.windows.net/test34343/Form 343 - Blank.pdf");
PdfDocument pdf = new PdfDocument(stream.Content.ReadAsStream());
string html = "<h1> Example Title <h1/>";
int rotation = 0;
int watermarkOpacity = 30;
pdf.ApplyWatermark(html, rotation, watermarkOpacity); Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;
pdf.SaveAs(Path.Combine(Directory.GetCurrentDirectory(), "test.pdf"));
2
Answers
u can use iTextSharp package from NuGet, then
You can try CoherentPDF from here:
https://www.nuget.org/packages/CoherentPDF/
The easy way to try first, would be to use the command line tools from https://community.coherentpdf.com/ and write
cpdf -stamp-on stamp.pdf in.pdf -o out.pdf
. If that works as you expect, the .NET tools will too.If you have example files, it will help us suggest why the watermarking is not working as you expect with IronPDF.