C# Console Application

The following steps outline creating a simple DynamicPDF Core Suite application.

  1. Open Visual Studio .NET (2010 - 2019) and create a new C# Console Application.
  2. On the Solution Explorer, right-click 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 Select.
  4. Click OK to add both references to the project.
  5. On the Solution Explorer, double-click Program.cs to view the code.
  6. Add the following using directives to the top of the file.
    using ceTe.DynamicPDF;
    using ceTe.DynamicPDF.PageElements;
    
    Imports ceTe.DynamicPDF
    Imports 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(pdfFilePath);
    
    Dim document As Document = New Document()
    Dim page As Page = New Page()
    page.Elements.Add(New Label( "Hello World!", 0, 0, 100, 12, Font.Helvetica, 12))
    document.Pages.Add(page)
    document.Draw(pdfFilePath)
    
  8. Run the project to generate the PDF document.
  9. View the PDF by navigating to the file on your file system.

In this topic