PDFsharp is the Open Source library that easily creates PDF documents from any .NET language.The same drawing routines can be used to create PDF documents, draw on the screen, or send output to any printer.
Here are just a few highlights:
This sample shows how to create a PDF document, add a page, draw some text, and save it to disk.
// Create a new PDF document PdfDocument document = new PdfDocument(); // Create an empty page PdfPage page = document.AddPage(); // Get an XGraphics object for drawing XGraphics gfx = XGraphics.FromPdfPage(page); // Create a font XFont font = new XFont("Verdana", 20, XFontStyle.Bold); // Draw the text gfx.DrawString("Hello, World!", font, XBrushes.Black, new XRect(0, 0, page.Width, page.Height), XStringFormat.Center); // Save the document... string filename = "HelloWorld.pdf"; document.Save(filename); // ...and start a viewer. Process.Start(filename);
The result is this:
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.