Foxit PDF Generator for .NET SDK

How to convert a text file to PDF?

To make text to PDF files conversion, follow the steps outlined below:

  1. Extract the text from the text file.
  2. Add the extracted text to a PDF using the TextArea class.Here is an example that adds “Hello World!” to a PDF.
       // Create a PDF Document

        Document document = new Document();

        // Create a PDF Page

        Page page = new Page();

        // Create a Text Area

        TextArea textArea = new TextArea("Hello World!", 10, 10, 200, 100);

        // Add the text area to the page


        // Add the page to the document


        // Save the document


Note: The class can be used to handle font size, color, alignment and other properties.

Updated on April 4, 2017

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: