.NET developers can easily make PDF using only our powerful product API. It means that our solution will provide programmers with everything they need to create PDF in C#.
With our C# library developers can easily make PDF from scratch. To do this, .NET developers need to perform just a few steps:
It is worth noting that a blank document is technically supposed to contain one paragraph, so when you programmatically create a PDF document, you will get exactly that basic document structure.
Note that you can instantly add content to a newly created PDF file. Thus, you will get not just an empty document, but a document containing the necessary content. For more information on how to edit a document, see the Editing page.
This .NET library allows you to programmatically create PDF documents. Try our powerful functionality and see how to create PDF using the following example:
dotnet add package Aspose.Words
Copy
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var font = builder.Font;
font.Name = "Courier New";
font.Color = Color.Blue;
font.Size = 36;
font.HighlightColor = Color.Yellow;
builder.Write("Morbi enim nunc faucibus a.");
doc.Save("Output.pdf");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// If NextSibling is null, then most likely this is the last Run in the Paragraph.
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
doc.Save("Output.pdf");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// If NextSibling is null, then most likely this is the last Run in the Paragraph.
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
var saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.BookmarksOutlineLevels.Add("Aspose bookmark", 1);
doc.Save("Output.pdf", saveOptions);
using Aspose.Words;
var doc = new Document();
var run = new Run(doc, "Proin eros metus, sagittis sed.");
var para = doc.FirstSection.Body.FirstParagraph;
para.AppendChild(run);
var comment = new Comment(doc)
{
Author = "John Doe",
Initial = "JD",
DateTime = DateTime.Now
};
comment.SetText("Quisque fringilla leo.");
var commentRangeStart = new CommentRangeStart(doc, comment.Id);
var commentRangeEnd = new CommentRangeEnd(doc, comment.Id);
run.ParentNode.InsertBefore(commentRangeStart, run);
run.ParentNode.InsertAfter(commentRangeEnd, run);
commentRangeEnd.ParentNode.InsertAfter(comment, commentRangeEnd);
comment.AddReply("Jane Doe", "JD", DateTime.Now, "Pellentesque vel sapien justo.");
doc.Save("Output.pdf");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// If NextSibling is null, then most likely this is the last Run in the Paragraph.
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
doc.Save("Output.pdf");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// If NextSibling is null, then most likely this is the last Run in the Paragraph.
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
var saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.BookmarksOutlineLevels.Add("Aspose bookmark", 1);
doc.Save("Output.pdf", saveOptions);
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// If NextSibling is null, then most likely this is the last Run in the Paragraph.
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
var saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.BookmarksOutlineLevels.Add("Aspose bookmark", 1);
doc.Save("Output.pdf", saveOptions);
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// If NextSibling is null, then most likely this is the last Run in the Paragraph.
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
doc.Save("Output.pdf");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// If NextSibling is null, then most likely this is the last Run in the Paragraph.
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
var saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.BookmarksOutlineLevels.Add("Aspose bookmark", 1);
doc.Save("Output.pdf", saveOptions);
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
Shape shape = builder.InsertChart(ChartType.Pie, 432, 252);
Chart chart = shape.Chart;
chart.Title.Text = "Demo Chart";
chart.Series.Clear();
chart.Series.Add("Series 1",
new string[] { "Category1", "Category2", "Category3" },
new double[] { 2.7, 3.2, 0.8 });
doc.Save("Output.pdf");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// If NextSibling is null, then most likely this is the last Run in the Paragraph.
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
doc.Save("Output.pdf");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// If NextSibling is null, then most likely this is the last Run in the Paragraph.
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
var saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.BookmarksOutlineLevels.Add("Aspose bookmark", 1);
doc.Save("Output.pdf", saveOptions);
There are three alternative options to install "Aspose.Words for .NET" onto your system. Please choose one that resembles your needs and follow the step-by-step instructions:
Our product is fully cross-platform and supports all major .NET implementations:
As far as .NET code doesn't depend on the underlying hardware or operating system, but only on a Virtual Machine, you are free to develop any kind of software for Windows, macOS, Android, iOS and Linux. Just make sure you have installed the corresponding version of .NET Framework, .NET Core, Windows Azure, Mono or Xamarin.
We recommend using Microsoft Visual Studio, Xamarin, and MonoDevelop integrated development environments to create C#, F#, VB.NET applications.
Fore more details please refer to Product Documentation.