I'm looking for a way to add an extra layer to a PDF document. The layer should be on top of existing layers and should display a text I want to put on there, kind of like a watermark. At the moment we have a way of doing this, but this just adds the text onto the picture embedded in the PDF, that's not what I want. Anyone has any ideas if there are libraries (free ones would be great) which do this?
Do one of the following: Choose Tools > Stamp > Custom Stamps. Choose Tools > Comment > Stamps > Custom Stamps > Manage Stamps.
We user MigraDoc,
http://www.pdfsharp.net/MigraDocOverview.ashx?AspxAutoDetectCookieSupport=1
More specifically the PdfSharp library in PdfSharp.dll,
PdfDocument doc = PdfReader.Open(pdf1Point4FileDataStream, PdfDocumentOpenMode.Modify)
foreach (PdfPage page in doc.Pages)
{
page.Orientation = PdfSharp.PageOrientation.Portrait;
var gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append, XPageDirection.Downwards);
gfx.DrawString(approvalWatermark, approvalFont, watermarkBrush, new XPoint((page.Width - maxWidth + approvalDiff) / 2 - space - moveLeft, page.Height / 2 - height1 - space), format);
}
Just a bit of code taken from our project, so it is a bit incomplete. Take a look at the library and classes, there will be some documentation around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With