Hi guys,
I'm hoping you can help me with this one.
What I'm basically trying to do is to read the file, write a string on the first page using DrawString. It works most of the time but there are a few PDF files that DrawString can't seem to write on the page.
One of the offending files can be downloaded here.
http://dl.dropbox.com/u/1774750/test.pdfThe code:
XStringFormat format = new XStringFormat();
format.Alignment = XStringAlignment.Near;
format.LineAlignment = XLineAlignment.Near;
PdfDocument inPDF1 = PdfReader.Open(_sourcePDF, PdfDocumentOpenMode.Modify);
PdfPage page = inPDF1.Pages[0];
XFont font = new XFont("Verdana", 14, XFontStyle.BoldItalic);
// Get an XGraphics object for drawing
XGraphics gfx = XGraphics.FromPdfPage(page);
string watermark = "Hello world!";
XSize marksize = gfx.MeasureString(watermark, font);
gfx.DrawString(watermark, font, XBrushes.Red, new XPoint(20,(page.Height - (marksize.Height + 10)) ),format);
Thanks in advance