new user here, so howdy !
So i try to explain what i'm trying to achieve here - pdf watermarking with itextsharp.
Each PDF file needs a watermark in this catalog.
Each page of a pdf file needs a watermark.
Watermark needs to be the name of the file without the file extension (.PDF).
Watermark position fixed, say top-middle or bottom-middle of a page, pdf's are in A4 size always.
Pdf's must keep their original file names and stay in the same folder "c:\ftp_out\test" after watermarking.
I must add i'm not a programmer so bear with me. But i'm learning :)
At one point i created a forum topic and asked for help:
So i pretty much implemented everything there but as i 'm not programmer i don't know how to define and use variables in this script.
Created a package variable "Pdf_To_Stamp", created a for each loop container with a following collection, added the variable i mentioned earlier and gave initial value of 0 under "variable mappings"
PDF's are in the catalog "c:\ftp_out\test", "Files" value is "*.PDF", Fully qualified. No other settings for "foreach loop"
Inside of the foreach loop i placed a script task, readonlyvariables i put the "User::Pdf_To_Stamp" i mentioned earlier. the script it self is following:
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
public static byte Stamp(byte resource)
PdfReader reader = new PdfReader(resource);
using (var ms = new MemoryStream())
using (PdfStamper stamper = new PdfStamper(reader, ms))
PdfContentByte canvas = stamper.GetOverContent(1);
new Phrase("name of the pdf file without the extension (.PDF) needed "),
36, 540, 0
But as you guessed correctly, it's not working :) So i'm clearly missing something here.
So i'm kindly asking for your help to solve this for me