I thought I’d post this because I couldn’t find any other information on the forums about it and I think this could be useful to many people. I was able to dump my dependency on PDFSharp after finding this. You need to add Xceed.Pdf and System.Drawing as a reference for this to work.
The only thing I’ve found wierd about it so far is if I write only text it wont show up until I draw a line. So as a work around I call myPage.Graphics.DrawLine(2000, 2000, 2001, 2000); on a coordinate off the screen to get it to render.
Xceed.Pdf.Document myDoc = new Xceed.Pdf.Document();
Xceed.Pdf.Page myPage = myDoc.Pages.AddPage();
Font font = new Font(“Verdana”, 20, FontStyle.Bold);
myPage.Font(font, true);
myPage.Graphics.Brush = Brushes.Black;
myPage.Graphics.Pen = new Pen(myPage.Graphics.Brush);
myPage.Graphics.Font = font;
myPage.Graphics.DrawString(10, 10, “test123”);
// Draw a line off screen to render any unrendered items
myPage.Graphics.DrawLine(2000, 2000, 2001, 2000);
myDoc.Generate(“test.pdf”);
Imported from legacy forums. Posted by Brandon (had 2727 views)