Wonder if this possible. Saw many posts on adding watermark after the pdf is created and saved in disk. But during creation of document how do i add a image watermark. I know how to add a image to document. But how do i position it such that it comes at the end of page.
Choose Document > Watermark > Add. Specify the watermark: To reuse a watermark and watermark options that you saved in an earlier session, select it from the Saved Settings menu. To create a text watermark, select Text, and type the text in the box.
What is ITextSharp? iTextSharp is a free and open source assembly that helps to convert page output or HTML content in a PDF file. Now add that DLL in the application. Getting Started: Start Visual Studio and create a new website in ASP.Net and add these 2 DLLs to the solution.
For C#, use this code...
//new Document
Document DOC = new Document();
// open Document
DOC.Open();
//create New FileStream with image "WM.JPG"
FileStream fs1 = new FileStream("WM.JPG", FileMode.Open);
iTextSharp.text.Image JPG = iTextSharp.text.Image.GetInstance(System.Drawing.Image.FromStream(fs1), ImageFormat.Jpeg);
//Scale image
JPG.ScalePercent(35f);
//Set position
JPG.SetAbsolutePosition(130f,240f);
//Close Stream
fs1.Close();
DOC.Add(JPG);
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