How to draw watermark text whose outline color is red and inner color is gray using iTextSharp
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are using a watermark I’m assuming that you are talking about a
PdfStamper. If so, once you’ve got a rawPdfContentByteusing eitherGetOverContent()orGetUnderContent()there’s just a couple of properties that you need to set.PdfContentByte.SetLineWidth(single)– set the stroke thicknessPdfContentByte.SetColorFill(BaseColor.GRAY)– set the fill color. You can also use any of the other color methods such asSetRGBColorFill()orSetCMYKColorFill()PdfContentByte.SetColorStroke(BaseColor.RED)– set the stroke colorPdfContentByte.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE)– flag that you want text to be draw with both a fill and a strokeBelow is a full working WinForms app targetting iTextSharp 5.1.1.0 that puts it all together. You should be able to move this to ASP.Net fairly easily as well as convert it to C# if needed.