ByteScout PDF SDK - C# - Create New PDF Document - ByteScout

ByteScout PDF SDK – C# – Create New PDF Document

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – C# – Create New PDF Document

How to create new PDF document in C# using ByteScout PDF SDK

How to create new PDF document in C#

The sample shows steps and algorithm of how to create new PDF document and how to make it work in your C# application. ByteScout PDF SDK is the pdf library that can create, update and modify PDF files. Supports text with fonts and style selections, layers, form fields, drawing lines and objects, automatic tables, images. Can be used to create and fill pdf forms and you can use it to create new PDF document with C#.

The SDK samples like this one below explain how to quickly make your application do create new PDF document in C# with the help of ByteScout PDF SDK. In order to implement the functionality, you should copy and paste this code for C# below into your code editor with your app, compile and run your application. Enjoy writing a code with ready-to-use sample codes in C#.

ByteScout free trial version is available for download from our website. It includes all these programming tutorials along with source code samples.

Try ByteScout PDF SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

Program.cs
      
using System.Diagnostics; using Bytescout.PDF; namespace CreateDocument { /// <summary> /// This example demonstrates how to create a document and save it to file. /// </summary> class Program { static void Main() { // Create new document Document pdfDocument = new Document(); pdfDocument.RegistrationName = "demo"; pdfDocument.RegistrationKey = "demo"; // Add page Page page = new Page(PaperFormat.A4); pdfDocument.Pages.Add(page); // Add sample content Font font = new Font(StandardFonts.Times, 24); Brush brush = new SolidBrush(); page.Canvas.DrawString("Hello world!", font, brush, 20, 20); // Save document to file pdfDocument.Save("result.pdf"); // Cleanup pdfDocument.Dispose(); // Open result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } }

Try ByteScout PDF SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

VIDEO

ON-PREMISE VERSION INFORMATION

Get 60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Get ByteScout PDF SDK Free Training

WEB API

Get Your Free API Key

Explore Web API Documentation

Tutorials:

prev
next