by aspose_seo (5 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Mon 4th February 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)
We often get queries from customers who would like to convert their text files to PDF. We are often asked if we can quickly provide some code
Dim tr As System.IO.TextReader = New StreamReader("test.txt")
'Instantiate Pdf pbject by calling its empty constructor
Dim pdf1 As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()
'Create a new section in the Pdf object
Dim sec1 As Aspose.Pdf.Section = pdf1.Sections.Add()
'Create a new text paragraph and pass the text to its constructor as argument
Dim t2 As Aspose.Pdf.Text = New Aspose.Pdf.Text(tr.ReadToEnd())
sec1.Paragraphs.Add(t2)
pdf1.Save("test.Pdf")
[C#]
System.IO.TextReader tr = new StreamReader("test.txt");
//Instantiate Pdf pbject by calling its empty constructor
Aspose.Pdf.Pdf pdf1 = new Aspose.Pdf.Pdf();
//Create a new section in the Pdf object
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();
//Create a new text paragraph and pass the text to its constructor as argument
Aspose.Pdf.Text t2 = new Aspose.Pdf.Text(tr.ReadToEnd());
sec1.Paragraphs.Add(t2);
pdf1.Save("test.Pdf");
No comments have been posted about We often get queries from customers who would like to convert their text files to PDF. We are often. Why not be the first to post a comment about We often get queries from customers who would like to convert their text files to PDF. We are often.