PDF Library for C# and VB.NET applications
The fastest way to get started with the GemBox.Pdf library is by exploring our collection of C# and VB.NET examples. These are live examples that show supported features and APIs for achieving various PDF-related tasks with the GemBox.Pdf component. GemBox.Pdf requires only .NET, it doesn't have any other dependency. The first step in using the GemBox.Pdf library is to add a reference to GemBox.Pdf.dll within your C# or VB.NET project. There are three ways to do that. a) Add from NuGet. You can add GemBox.Pdf as a package by using the following command from the NuGet Package Manager Console: Or you can search and add GemBox.Pdf from the NuGet Package Manager. b) Add from a DLL file. You can download a GemBox.Pdf.dll file from this page and add a reference by browsing to it. c) Add from Setup. You can download the GemBox.Pdf Setup from this page. After installing the setup, you can add a reference to GemBox.Pdf.dll from the Global Assembly Cache (GAC). The second step is to add a directive for the GemBox.Pdf namespace. For a C# project, use: Since the following example draws text to PDF page content, add a directive for the GemBox.Pdf.Content namespace. For a C# project, use: The third step is to set the license key to use GemBox.Pdf in one of its working modes. To use a Free mode in a C# project, use: You can read more about GemBox.Pdf's working modes on the Evaluation and Licensing help page. The last step is to write your application-specific PDF code, like the following example code, which shows how to create a simple PDF document with "Hello World!" text. It shows how to initialize the GemBox.Pdf document structure, add new GemBox.Pdf library simplifies PDF page content operations by compiling them into elements of text, paths, and external objects (images and forms). These elements are added to PDF page content when drawing Adding new textual content to a PDF document is supported via If you want to create complex PDF documents, use GemBox.Document, GemBox.Spreadsheet, and GemBox.Presentation, which all have PDF exporting capability.System Requirements
You can use it on:Hello World
Install-Package GemBox.Pdf
using GemBox.Pdf;
For a VB.NET project, use: Import GemBox.Pdf
using GemBox.Pdf.Content;
For a VB.NET project, use: Import GemBox.Pdf.Content
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
To use a Free mode in a VB.NET project, use: ComponentInfo.SetLicense("FREE-LIMITED-KEY")
PdfPage
, draw PdfFormattedText
, and then save a PdfDocument
to a PDF file.using GemBox.Pdf;
using GemBox.Pdf.Content;
class Program
{
static void Main()
{
// If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = new PdfDocument())
{
// Add a page.
var page = document.Pages.Add();
// Write a text.
using (var formattedText = new PdfFormattedText())
{
formattedText.Append("Hello World!");
page.Content.DrawText(formattedText, new PdfPoint(100, 700));
}
document.Save("Hello World.pdf");
}
}
}
Imports GemBox.Pdf
Imports GemBox.Pdf.Content
Module Program
Sub Main()
' If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Using document = New PdfDocument()
' Add a page.
Dim page = document.Pages.Add()
' Write a text.
Using formattedText = New PdfFormattedText()
formattedText.Append("Hello World!")
page.Content.DrawText(formattedText, New PdfPoint(100, 700))
End Using
document.Save("Hello World.pdf")
End Using
End Sub
End Module
PdfFormattedText
.PdfFormattedText
, such as in these Writing examples.