Aspose.PDF for .NET API lets you create and read PDF files using C# and VB.NET. The API can be used in a variety of .NET applications including WinForms, ASP.NET, and several others. In this article, we are going to show how to use Aspose.PDF for .NET API to easily generate and read PDF files in .NET applications.
How to Create PDF File using C#
To create a PDF file using C#, the following steps can be used.
- Create an object of Document class
- Add a Page object to the Pages collection of the Document object
- Add TextFragment to Paragraphs collection of the page
- Save the resultant PDF document
In this case, we create a PDF one-page document with A4 page size, portrait orientation. Our page will contain a “Hello, World” in the upper left part of the page.