Skip to main content

C# Console Application

Version: 6.0

C# Console Application

  1. Open Visual Studio .NET (2005 or 2008) and create a new C# Console Application.
  2. On the Solution Explorer, right click on the References folder and select "Add reference...".
  3. Select "DynamicPDF for .NET" from the list on the ".NET" tab (use the appropriate Framework version) and click the "Select" button.
  4. Click the "OK" button to add both references to the project.
  5. On the Solution Explorer, double click on the "Program.cs" class to view the code.
  6. Add the following using directives to the top of the file:
    using ceTe.DynamicPDF;
    using ceTe.DynamicPDF.PageElements;
  7. Add the following code to the "Main" method:
    Document document = new Document();
    Page page = new Page();
    page.Elements.Add( new Label( "Hello World!", 0, 0, 100, 12, Font.Helvetica, 12 ) );
    document.Pages.Add( page );
    document.Draw( "C:\\\\HelloWorld.pdf" );
  8. Run the project to generate the PDF document. You can view it by navigating to it on your file system.