How to convert plain text to pdf without using iTextSharp.dll

Posted by Mahe under ASP.NET on 7/18/2012 | Points: 10 | Views : 2986 | Status : [Member] | Replies : 4
Hi All,


How to convert plain text to pdf without using iTextSharp.dll

Regards,
Mahe




Responses

Posted by: Megan00 on: 7/18/2012 [Member] Starter | Points: 25

Up
0
Down
haha, how aboutPDF component http://www.e-iceblue.com/Introduce/pdf-for-net-introduce.html , look this, it may help you to convert .txt to PDF clearly :

		Private Shared Sub DrawText(section As PdfSection)

Dim text As String = File.ReadAllText("..\..\test.txt")
Dim page As PdfPageBase = section.Pages.Add()
Dim font As New PdfFont(PdfFontFamily.Helvetica, 11)
Dim format As New PdfStringFormat()
format.LineSpacing = 20F
Dim pageWidth As Single = page.Canvas.ClientSize.Width
Dim brush As PdfBrush = PdfBrushes.LightSeaGreen
Dim y As Single = 30
Dim textLayouter As New PdfStringLayouter()
Dim result As PdfStringLayoutResult = textLayouter.Layout(text, font, format, New SizeF(pageWidth, 0))

For Each line As LineInfo In result.Lines
page.Canvas.DrawString(line.Text, font, brush, 0, y, format)
y = y + result.LineHeight


Never give up! Smile to the world!
http://excelcsharp.blog.com/

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Taanu51 on: 7/19/2012 [Member] Starter | Points: 25

Up
0
Down
Yes We can create PDF using ItextSharp.dll Check this tutorials it may helps you

http://www.developerscode.com/2012/05/create-password-protected-pdf-using.html

http://www.developerscode.com/2012/05/generate-random-password-for-pdf-with.html

Tanisha Sayyad
.Net and Android Developer
INDIA(Andhra Pradesh)

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Evanpan on: 3/4/2016 [Member] Starter | Points: 25

Up
0
Down
Something went wrong with my pdf reader. I wanna convert pdf to text first. Any suggestion will be appreciated. Thanks in advance.
( http://www.pqscan.com/pdf-to-text/ )
How about the one abovementioned.

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajeeshmenoth on: 3/8/2016 [Member] Starter | Points: 25

Up
0
Down
Hi,

Check the previous answer : http://www.dotnetfunda.com/forums/show/7083/how-to-convert-a-plain-text-to-pdf-file-using-csharp

Thanks
RajeeshMenoth (Rajeesh M R)

Tech Blog

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response