Hello,
I use the code (c#) at the bottom of this post to insert some kind of
text-stamp/watermark onto a PDF-File.
The question is: is it possible, and if yes how to make this text
tranparent? Meaning the content of the document should light through the
watermark.
Thank you!
Regards, uwe
Code:
PdfReader reader = new PdfReader(filePath);
reader.RemoveUnusedObjects();
using (FileStream fs = new FileStream(tempFilePath, FileMode.Create))
{
PdfStamper stamp = new PdfStamper(reader, fs, reader.PdfVersion, false);
int n = reader.NumberOfPages;
Rectangle dimensions;
BaseFont bf = BaseFont.CreateFont(fontPath, BaseFont.WINANSI,
BaseFont.NOT_EMBEDDED);
iTextSharp.text.Color iColor = new
iTextSharp.text.Color(color.ToArgb());
for (int index = 1; index <= n; index++)
{
PdfContentByte cb = stamp.GetOverContent(index);
dimensions = reader.GetPageSizeWithRotation(index);
// change the content on top of page 1
cb.BeginText();
cb.SetFontAndSize(bf, (float)fontSize);
cb.SetCharacterSpacing((float)characterSpacing);
cb.SetColorFill(iColor);
float x = (float)horzPos;
float y = (float)vertPos;
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, text,
dimensions.GetLeft(x),
dimensions.GetTop(y), (float)orientation);
cb.EndText();
}
stamp.Close();
reader.Close();
}
--
View this message in context:
http://www.nabble.com/Insert-transparent-Text-tp18501936p18501936.html
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar