如何使用C#打印文本的具体位置?如何使用、具体位置、文本

由网友(挽风)分享简介:我如何打印领域到指定的页面位置?举例来说,我有一个印刷本,我想在这些特定/分隔空间的打印数据。How can I print a field to a specific page location?For instance, I have a printed form and I want to print da...

我如何打印领域到指定的页面位置? 举例来说,我有一个印刷本,我想在这些特定/分隔空间的打印数据。

How can I print a field to a specific page location? For instance, I have a printed form and I want to print data in those specific/delimited spaces.

我已经看到了一些例子,但并不适用于我的需要。

I've seen some examples, but they do not apply to my need.

HTTP://www.codeproject.com /用品/ 10180 /怎样对打印的文本中-C

http://stackoverflow.com/questions/7703274/how-to-create-page-with-text-in-specific-location

最后一个,如果没有关闭,我认为它会找到了答案。

The last one if wasn't closed I think it'd have the answer.

任何想法?

感谢。

推荐答案

如果你有一个文件的形式,你可以扫描它,并将其转换为PDF表单与像CutePDF程序。接下来,创建你希望能够填补(通过拖动矩形),他们的名字,并保存表单中的字段。 iTextSharp的是一个C#库,可以让你在表单字段填写一个纲领性的方式。

If you have a paper form, you can scan it in, and convert it to a PDF form with a program like CutePDF. Next, create the fields you want to be able to fill in (by dragging rectangles), name them, and save the form. iTextSharp is a C# library that lets you fill in the form fields in a programmatic way.

例如:

//Replace with path to the form
var pdfFormLocation = "C:pdfForm.pdf"; 

//Adjust below path to a temp location
var pdfPath = String.Format("C:temp{0}", Guid.NewGuid().ToString());
File.Copy(pdfFormLocation, pdfPath, true);

var reader = new PdfReader(pdfPath);
var output = new FileStream();
var stamper = new PdfStamper(reader, output);

//the form field names can be a little hairy
stamper.AcroFields.SetField("topmostSubform[0].Page1[0].f1_01_0_[0]", "Your Name");

//make the form no longer editable
stamper.FormFlattening = true;

stamper.Close();
reader.Close();
//now you can go print this file from pdfPath

链接: iTextSharp的 CutePDF

Links: iTextSharp CutePDF

阅读全文

相关推荐

最新文章