I'm using Itext
The code is in Boo, Opens "template.pdf" and draw a rectangle and write "hello world" then create a new pdf file and open it
import iTextSharp.text
import iTextSharp.text.pdf
import iTextSharp.text.Color
import System.IO
import iTextSharp.text
import System.Diagnostics
# we create a reader for a certain document
reader = PdfReader("template.pdf")
# we retrieve the size of the first page
psize = reader.GetPageSize(1);
# step 1: creation of a document-object
Document.Compress = true
documentGlobal = Document(psize, 50, 50, 50, 50)
# step 2: we create a writer that listens to the document
thePdfFile = MemoryStream()
writer = PdfWriter.GetInstance(documentGlobal, thePdfFile)
documentGlobal.Open()
cbLocal = writer.DirectContent
page1 = writer.GetImportedPage(reader, 1)
cbLocal.AddTemplate(page1, 1f, 0, 0, 1f, 0, 0)
#Drawing a rectangle
rec = Rectangle(100, 100, 150, 150)
rec.BackgroundColor = iTextSharp.text.Color(0,0,0)
cbLocal.Rectangle(rec);
#Writing some text
#There are many ways to write text, check the examples
bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED)
font = Font(bf, 10, 0)
font.SetColor(0, 0, 0)
ColumnText.ShowTextAligned(cbLocal, 0, Phrase("Hello World", font), 50, 50, 0)
documentGlobal.Close()
tempFile = Path.GetTempFileName();
ms = MemoryStream(thePdfFile.ToArray());
stream = FileStream(tempFile + ".pdf", FileMode.Create);
ms.WriteTo(stream);
ms.Close();
stream.Close();
Process.Start(tempFile + ".pdf");
Edit
Oop, It seems I did not understand the question....