简体   繁体   English

在C#中将CSV转换为PDF文件

[英]CSV to PDF file in c#

I am trying to convert a comma separated string(CSV) file to pdf file in C# using the iTextSharp library. 我正在尝试使用iTextSharp库将逗号分隔的字符串(CSV)文件转换为C#中的pdf文件。 I would like to know if there is any other free or more efficient tool/way for this type of conversion. 我想知道是否有其他免费或更有效的工具/方式用于这种类型的转换。

You can use iTextSharp 您可以使用iTextSharp

Here's an example: 这是一个例子:

Document pdfDoc = new Document();
string path = @"c:\file.pdf";
PdfWriter writer = PdfWriter.GetInstance( pdfDoc, new FileStream(path, FileMode.OpenOrCreate));
pdfDoc.Open();
pdfDoc.Add(new Paragraph("your data"));
pdfDoc.Close();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM