将文本另存为pdf文件 [英] Save text as a pdf file
本文介绍了将文本另存为pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从文本(数据行,.txt文件或字符串)创建一个.pdf文档.例如我在数据库中有一个条目,我想将单个行/列/单元格以pdf格式(作为pdf文件)保存为整个页面.
我还试图避免使用第三方工具或.dll.任何帮助,将不胜感激.
谢谢.
Hi,
I need to create a .pdf document from text (datarow , .txt file or string). e.g. I have an entry in a database , i want to save a single row/column/cell as an entire page in pdf format (as a pdf file).
Im also trying to avoid using 3rd party tools or .dlls. Any help would be appreciated.
Thanks.
推荐答案
如果您想完全避免使用第三方工具/DLL(包括pdf打印机驱动程序),则必须手动实现PDF编写器(一项艰巨的任务,可能需要花几个月的时间.我建议您重新考虑有关使用第三方库/工具/驱动程序的决定.
If you want to totally avoid 3rd party tools/DLLs (including pdf printer drievrs), then you''d have to manually implement a PDF writer (a mammoth task that may need several man months). I''d suggest that you reconsider your decision regarding using a 3rd party lib/tool/driver.
您会看到,如果要避免使用第三方库,您可能会创造自己的.你负担得起吗?但是,如果您只想使用第3部分的源代码,而不想使用预编译的可执行文件,那么这是非常合理的.我建议使用iTextSharp.这是iTextSharp的.NET端口,iTextSharp是用于处理PDF的开放源代码库.
参见:
http://en.wikipedia.org/wiki/IText [ http://itextpdf.com/ [ ^ ],
http://sourceforge.net/projects/itextsharp/ [
You see, if you want to avoid 3-rd party libraries, you maybe bound to creation of your own. Could you afford it? However, if you want to use only 3rd-part source code but not precompiled executables, this is very reasonable. I would recommend to use iTextSharp. This is a .NET port of iTextSharp, an Open Source library used to work with PDF.
See:
http://en.wikipedia.org/wiki/IText[^],
http://itextpdf.com/[^],
http://sourceforge.net/projects/itextsharp/[^] (you can download iTextSharp here).
Good luck,
—SA
如果没有库或进行大量工作,就无法使用.pdf进行所需的操作. Winovative具有良好的库,这些库可以自动进行零编码的html转换.
我建议使用excel而不是pdf格式.您仍然需要一个html包装器.
这是将HTML转换为excel的方法的链接. http://www.codeproject.com/Tips/272244/Export-any-page-to-excel-automatically-asp-net
There is no way to do what you want with .pdf without a library or a bunch of work. Winovative has good libraries that are automatic with zero coding for html conversion.
I recommend using excel instead of pdf format. Your still going to have to have a html wrapper though.
Here is a link to a way to convert HTML to excel. http://www.codeproject.com/Tips/272244/Export-any-page-to-excel-automatically-asp-net
这篇关于将文本另存为pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文