How to Create a New PDF Document

1. Start Visual Studio IDE. Create a new project or open existing one.

2. Add a reference to PDFMosaic.dll by opening the Add Reference dialog and selecting the PDFMosaic assembly from the list of the .NET assemblies.

Reference to PDFMosaic.dll

 

C# :

using PDFMosaic;
using System;

namespace GettingStarted
{
  class GettingStarted
  {
    static void Main()
    {
      LicenseManager.SetLicenseData("demo@demo", "demo");

      PDFDocument document = new PDFDocument();
      PDFPage page = new PDFPage(PDFPaperFormat.A4);

      PDFFont font = new PDFFont(PDFStandardFont.Helvetica, 16);
      PDFBrush brush = new PDFSolidBrush();
      page.Canvas.DrawString("Hello!", font, brush, 100, 100);

      document.Pages.Add(page);
      document.Save("Hello.pdf", true);
    }
  }
}

 

Visual Basic :

Imports PDFMosaic
Imports System

Module GettingStarted
  Sub Main()
    LicenseManager.SetLicenseData("demo@demo", "demo")

    Dim document As New PDFDocument()
    Dim page As New PDFPage(PDFPaperFormat.A4)

    Dim font As New PDFFont(PDFStandardFont.Helvetica, 16)
    Dim brush As New PDFSolidBrush()
    page.Canvas.DrawString("Hello!", font, brush, 100, 100)

    document.Pages.Add(page)
    document.Save("Hello.pdf", True)
  End Sub
End Module