Product Family

Create PDF Files via C#

Native and high performance PDF files creation without Adobe Acrobat installation using server side .NET APIs.

Creating Adobe Acrobat PDF file dynamically within running application is easy. In order to create PDF documents from scratch without requiring Adobe Acrobat, we’ll use Aspose.PDF for .NET API that offers different features for PDF creation, manipulation and conversion using .NET platform. Beside create PDF C# code, programmers can enhance and update code to create graphics, images, insert tables and submission forms easily.

How to Create PDF via C#

It is easy for the developers to creat, load, modify and convert PDF files directly from C# application in just a few lines of code.

  1. Include the namespace in your class file
  2. Intialize Document class object.
  3. Add a page using Pages.Add() method.
  4. Create a new TextFragment object and set its text.
  5. Add TextFragment to the Paragraphs collection of the page.
  6. Save the PDF using Save(String) method.
  7. Double click and open the PDF file to view content.

System Requirements

Just make sure that system have Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms as well as development environment like Microsoft Visual Studio.

  • Install from command line as nuget install Aspose.PDF or via Package Manager Console of Visual Studio with Install-Package Aspose.Pdf.
  • Alternatively, get the offline MSI installer or all DLLs in a ZIP file from downloads

Following source code shows how to create a PDF file using C#.

// Initialize document object
Document pdf_doc = new Document();

// Add page
Page page = pdf_doc.Pages.Add();

// Place the text of choice
page.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment("Text of choice"));

// PDF file created at a specified location
A PDF Processing Library to create cross-platform applications with the ability to generate, modify, convert, render, secure and print documents without using Adobe Acrobat. It supports converting various file formats into PDF including HTML and converting PDF documents into various output formats. Developers can easily render all HTML content in a single Page PDF as well as convert HTML files with SVG graphic tags to Tagged PDF files. .NET PDF API offers compression, table creation, graph & image functions, hyperlinks, stamp and watermarking tasks, extended security controls & custom font handling.

PDF What is PDF File Format

Portable Document Format (PDF) is a type of document created by Adobe back in 1990s. The purpose of this file format was to introduce a standard for representation of documents and other reference material in a format that is independent of application software, hardware as well as Operating System. PDF files can be opened in Adobe Acrobat Reader/Writer as well in most modern browsers like Chrome, Safari, Firefox via extensions/plug-ins. Most of the commercially available software suites also offer conversion of their documents to PDF file format without the requirement of any additional software component.

Read More