Aspose.Pdf.Examples.CSharp.AsposePdfGenerator.TechnicalArticles.ConvertTextFile.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {         
            // ExStart:ConvertTextFile
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_TechnicalArticles();

            // Read the source text file
            System.IO.TextReader tr = new StreamReader(dataDir + "test.txt");

            // Instantiate Pdf pbject by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Create a new section in the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a new text paragraph and pass the text to its constructor as argument
            Aspose.Pdf.Generator.Text t2 = new Aspose.Pdf.Generator.Text(tr.ReadToEnd());
            sec1.Paragraphs.Add(t2);

            pdf1.Save(dataDir + "ConvertTextFile_out.Pdf");
            // ExEnd:ConvertTextFile           
            
        }
        public static void ConvertLargeTextFile()