PDFsharp & MigraDoc Foundation http://forum.pdfsharp.de/ |
|
DrawString won't work on this PDF http://forum.pdfsharp.de/viewtopic.php?f=2&t=1332 |
Page 1 of 1 |
Author: | hubertd [ Tue Sep 14, 2010 11:54 pm ] |
Post subject: | DrawString won't work on this PDF |
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.pdf The 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 |
Author: | hubertd [ Wed Sep 15, 2010 5:03 am ] |
Post subject: | Re: DrawString won't work on this PDF |
Don't worry about this. I found a work around here. viewtopic.php?p=2860#p2860 |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |