Convert text to PDF in C#
TXT to PDF
Nutrient .NET SDK converts plain-text files to PDF.
Download samplePrepare the project
Register the SDK license before running conversion operations. For setup details, refer to the getting started with .NET SDK guide.
using GdPicture14;
LicenseManager license = new LicenseManager();license.RegisterKEY("");Convert a text file to PDF
using GdPictureDocumentConverter converter = new GdPictureDocumentConverter();
GdPictureStatus status = converter.LoadFromFile(@"input.txt", GdPicture14.DocumentFormat.DocumentFormatTXT);if (status != GdPictureStatus.OK){ throw new Exception(status.ToString());}
status = converter.SaveAsPDF("output.pdf");if (status != GdPictureStatus.OK){ throw new Exception(status.ToString());}