ADD WATERMARK EXAMPLE

The following .NET application has been developed using ABCpdf, ASP.NET, and the C# language.

This ABCpdf example creates a PDF document that adds a watermark to the current page.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Text;
using System.Net;
using System.IO;
using WebSupergoo.ABCpdf8;

namespace ABCpdfExamples
{
    public partial class test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // ---- Adds a watermark to the current page ----
            string thePath;
            Doc doc = new Doc();
            doc.Read(Server.MapPath("~/Results/AddBookMark.pdf"));
            int theCount = doc.PageCount;

            int theID = 0;
            for (int i = 1; i <= theCount; i++)
            {
                doc.PageNumber = i;
                doc.Layer = doc.LayerCount + 1;
            if (i == 1)
                {
                    thePath = Server.MapPath("~/images/watermark.jpg");
                    theID = doc.AddImageFile(thePath, 1);
                }
            else
                    doc.AddImageCopy(theID);
            }
            doc.Save(Server.MapPath("~/Results/Output.pdf"));
            doc.Clear();
        }
    }
}

Add Watermark

© 1997-2021    Codehacker - All Rights Reserved