I’m trying to use PDFSharp to add 2 text strings to a document – one as normal and 1 upside-down. How do I add the inverted text?
This is the code I’m using to add the normal text:
PdfDocument doc = PdfReader.Open(_path, PdfDocumentOpenMode.Modify);
PdfPage pdfPage = doc.Pages[0];
XGraphics gfx = XGraphics.FromPdfPage(pdfPage);
//
XTextFormatter tf = new XTextFormatter(gfx);
XFont fontHeader = new XFont("Arial", 24, XFontStyle.Bold);
//
XRect topRect = new XRect(200, 0, 200, 100);
tf.Alignment = XParagraphAlignment.Center;
tf.DrawString(_reference, fontHeader, XBrushes.Black, topRect, XStringFormats.TopLeft);
//
doc.Save(_path);
doc.Close();
doc=null;
You’ll have to use transformation, presumably RotateTransform.
See this thread on the PDFsharp forum for an example:
http://forum.pdfsharp.net/viewtopic.php?p=5413#p5413