Click here to Skip to main content
15,887,240 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
I am looking for c# code that can convert a text file to pdf. I get some solution in codeproject but it's not clear cut. Please help me to solution this.
Posted
Comments
Uday P.Singh 10-Mar-12 10:24am    
whats the issue?
bellpatricia 4-Oct-17 5:17am    
Here is a straightforward way how you can create / generate a PDF file in C#:

var document = new DocumentModel();
document.Content.LoadText("Sample text.");
document.Save("Sample.pdf");

You need this PDF library for C# to run the code.

PDFCreator has a COM component, callable from .NET or VBScript (samples included in the download). Ref: http://sourceforge.net/projects/pdfcreator/[^]
 
Share this answer
 
Comments
thatraja 10-Mar-12 11:13am    
5!
Read this article:

Convert a Text File to a PDF File[^]

hope it helps :)
 
Share this answer
 
Comments
thatraja 10-Mar-12 11:13am    
5!
You can do it by using Microsoft.Interop. Take a look at this:
http://codeabout.wordpress.com/2012/03/20/convert-a-word-file-to-pdf-with-c/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900