PDFRasterizer.NET 4.0 is now available. Supports .NET Core. Renders pixel-perfectly.

Convert TXT to PDF

using System;
using System.IO;

using TallComponents.PDF.Layout;
using TallComponents.PDF.Layout.Paragraphs;
using TallComponents.PDF.Layout.Fonts;

namespace txt2pdf
   class Program
      static void Main(string[] args)
         Document document = new Document();
         Section section = new Section();
         section.PageSize = PageSize.Letter;

         string[] lines = File.ReadAllLines("test.txt");

         foreach (string line in lines)
            TextParagraph text = new TextParagraph();
            text.SpacingAfter = 12;

            Fragment fragment = new Fragment();
            fragment.FontSize = 12;
            fragment.Font = Font.Courier;
            fragment.Text = line;

         using (FileStream file = new FileStream(
            "test.pdf", FileMode.Create, FileAccess.Write))
Download TallPDF.NET 4.0
We will send you a download link

  • This field is for validation purposes and should be left unchanged.
Why do we ask your email address?
We send tips that speed up your evaluation
We let you know about bug fixes
You can always unsubscribe with one click
We never share your address with a 3rd party
Thank you for your download

We have sent an email with a download link.