title: PdfSharp - Getting started
body: <p>I have a C# console application and would like to add some of the functionality of PdfSharp to it.</p>
  
  <p>I've downloaded both zip files from <a href="http://sourceforge.net/projects/pdfsharp/support" rel="nofollow noreferrer">Sourceforge</a> ... both the assemblies and the source code. </p>
  
  <p>There seem to be a couple of ways to add the functionality</p>
  
  <ul>
  <li>a reference to the <code>.dll</code> file in the unzipped assemblies folder.</li>
  <li>actually add the projects to my solution.</li>
  </ul>
  
  <p>I'm trying to use the latter method.</p>
  
  <p>Is this all I need to do?</p>
  
  <ol>
  <li>I copied and pasted the folder "PdfSharp" from the unzipped source code file into my solution folder.</li>
  <li>In VS I went to Solution Explorer right-clicked the solution and chose <code>Add</code>><code>Existing Project...</code></li>
  <li>Then I chose the following ...</li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/RyNal.png" alt="enter image description here"></p>
  
  <p>I assume the projects <code>PdfSharp-ag.csproj</code>; <code>PdfSharp-Hybrid.csproj</code>; <code>PdfSharp-WPF.csproj</code> are for some other applications? what I mean is for my simple console application is all I need the project <code>PdfSharp.csproj</code>? </p>
  
  <p>Once I've followed the above steps my Solution looks like the following:</p>
  
  <p><img src="https://i.stack.imgur.com/t0AP4.png" alt="enter image description here"></p>
  
  <p>...and when expanded as so with a reference to PdfSharp in the original Projects reference section:</p>
  
  <p><img src="https://i.stack.imgur.com/JtZYq.png" alt="enter image description here"></p>
  
  <hr>
  
  <p>I then tested all was working ok with a console app using the following code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Drawing; //&lt;&lt; additional reference required
  
  using PdfSharp;
  using PdfSharp.Pdf;
  using PdfSharp.Drawing;
  
  namespace PDFsharpSolutionQF
  {
    class Program
    {
      static void Main(string[] args)
      {
  
  
        PdfDocument pdf = new PdfDocument();
        pdf.Info.Title = "My First PDF";
        PdfPage pdfPage = pdf.AddPage();
        XGraphics graph = XGraphics.FromPdfPage(pdfPage);
        XFont font = new XFont("Verdana",20,XFontStyle.Bold);
        graph.DrawString("This is my first PDF document",font,XBrushes.Black,new XRect(0,0,pdfPage.Width.Point,pdfPage.Height.Point),XStringFormats.Center);
        string pdfFilename = "firstpage.pdf";
        pdf.Save(pdfFilename);
        //Process.Start(pdfFilename);
  
      }
    }
  }
  </code></pre>