Adding an image as a watermark or a stamp on a PDF requires only a few lines of code using Foxit Quick PDF Library. Here’s some C# sample code:
/* Add an image watermark or stamp to an existing PDF document */ // Load a sample file from disk. We'll place the image // onto this file. DPL.LoadFromFile("filename.pdf", ""); // Select page 1 to watermark DPL.SelectPage(1); // Load your image into memory DPL.AddImageFromFile("myImage.png", 0); // Get width and height of the image int lWidth = DPL.ImageWidth(); int lHeight = DPL.ImageHeight(); // Draw the image onto the page using the specified width/height DPL.DrawImage(250, 450, lWidth, lHeight); // Save the updated file to the output folder DPL.SaveToFile("filename_watermarked.pdf"); |