如何将文本框值导出为pdf格式...? [英] How to Export textbox values to pdf form...?

查看:78
本文介绍了如何将文本框值导出为pdf格式...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何导出,文本框值和图像以导出pdf格式...

请帮助PLZ ...你能发送一些示例代码..plz

How to export, textbox values and images to export pdf form...
kindly help plz...can you send some sample code..plz

推荐答案

要使用PDF,您可以使用iText或其.NET端口,iTextSharp:

http://en.wikipedia.org/wiki/IText [ ^ ],

http://itextpdf.com/ [ ^ ],

http://sourceforge.net/projects/itextsharp/ [ ^ ]。



包括对Java iText网站的引用,因为大多数文档都在那里。如果您了解C#,那么理解基于Java的API文档并不困难。



-SA
To work with PDF, you can use iText, or its .NET port, iTextSharp:
http://en.wikipedia.org/wiki/IText[^],
http://itextpdf.com/[^],
http://sourceforge.net/projects/itextsharp/[^].

In included the reference to Java iText site as well, because most documentation is there. If you understand C#, it would not be difficult to understand Java-bases API documentation.

—SA

从这里下载pdfsharp的dll http://pdfsharp.codeplex.com/releases/view/37054





Download the dll of pdfsharp from here http://pdfsharp.codeplex.com/releases/view/37054


try
{
string textBoxText; // your Text Box text
System.IO.TextReader readFile = new StreamReader("Text.txt");
int yPoint = 0;

PdfDocument pdf = new PdfDocument();
pdf.Info.Title = "TXT to PDF";
PdfPage pdfPage = pdf.AddPage();
XGraphics graph = XGraphics.FromPdfPage(pdfPage);
XFont font = new XFont("Verdana", 20, XFontStyle.Regular );

while (true)
{
    if (string.IsNullOrEmpty("textBoxText"))
    {
        graph.DrawString(line, font, XBrushes.Black, new XRect(40, yPoint, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
        yPoint = yPoint + 40;
    }
}

string pdfFileName = "MyPdfFile.pdf";
pdf.Save(pdfFileName);
readFile.Close();
readFile = null; 
Process.Start(pdfFileName);
}
catch(Exception ex)
{
     //Log exception
}


这篇关于如何将文本框值导出为pdf格式...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆