Hi:
I have no idea how to log in to the forum. Is it itext or itextsharp?
What's the difference. Anyhow, I did sign up and I hope I have an
account. Anyhow, there is this code below. All I want to do is place a
piece of horizontal text in the lower right corner. Apparently, this
code says it is transparent and apparently going to the wrong place.
Would there be something out there to help me know what the constants
for the commands, as well as the commands themselves mean?
Thank you.
Public Shared Sub AddWatermarkText(ByVal sourceFile As String, ByVal
outputFile As String, ByVal watermarkText As String)
Dim reader As iTextSharp.text.pdf.PdfReader = Nothing
Dim stamper As iTextSharp.text.pdf.PdfStamper = Nothing
Dim gstate As iTextSharp.text.pdf.PdfGState = Nothing
Dim underContent As iTextSharp.text.pdf.PdfContentByte = Nothing
Dim rect As iTextSharp.text.Rectangle = Nothing
Dim pageCount As Integer = 0
reader = New iTextSharp.text.pdf.PdfReader(sourceFile)
rect = reader.GetPageSizeWithRotation(1)
stamper = New iTextSharp.text.pdf.PdfStamper(reader, New
System.IO.FileStream(outputFile, IO.FileMode.Create))
gstate = New iTextSharp.text.pdf.PdfGState()
gstate.FillOpacity = 1
gstate.StrokeOpacity = 1
pageCount = reader.NumberOfPages()
Dim watermarkFont As iTextSharp.text.pdf.BaseFont =
iTextSharp.text.pdf.BaseFont.CreateFont(iTextSharp.text.pdf.BaseFont.COU
RIER_BOLD, iTextSharp.text.pdf.BaseFont.CP1252,
iTextSharp.text.pdf.BaseFont.NOT_EMBEDDED)
For I As Integer = 1 To pageCount
underContent = stamper.GetUnderContent(1)
With underContent
.SaveState()
.SetGState(gstate)
.SetColorFill(iTextSharp.text.BaseColor.ORANGE)
.BeginText()
.SetFontAndSize(watermarkFont, 20)
.SetTextMatrix(30, 30)
.ShowTextAligned(iTextSharp.text.Element.ALIGN_BOTTOM,
watermarkText, rect.Width / 2, rect.Height / 2, 0)
.EndText()
.RestoreState()
Debug.WriteLine("watermarkText: " & watermarkText)
End With
Next
stamper.Close()
reader.Close()
End Sub
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php