用于创建标签的itextsharp编辑器 [英] itextsharp editor for creating tags

查看:100
本文介绍了用于创建标签的itextsharp编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否存在一些用于编辑itextsharp代码的程序。

I would like to know if exist some program for editing itextsharp code.

现在我在VS lile中直接编写代码:

Now I am writting code directly in VS lile:

// Delivery address details
int left_margin = 40;
int top_margin = 720;
writeText(cb, "Delivery address", left_margin, top_margin, f_cb, 10);
writeText(cb, drHead["delCustomerName"].ToString(), left_margin, top_margin-12, f_cn, 10);
writeText(cb, drHead["delAddress1"].ToString(), left_margin, top_margin-24, f_cn, 10);
writeText(cb, drHead["delAddress2"].ToString(), left_margin, top_margin-36, f_cn, 10);
writeText(cb, drHead["delAddress3"].ToString(), left_margin, top_margin-48, f_cn, 10);
writeText(cb, drHead["delZipcode"].ToString(), left_margin, top_margin-60, f_cn, 10);
writeText(cb, drHead["delCity"].ToString() + ", " + drHead["delCountry"].ToString(), left_margin+65, top_margin-60, f_cn, 10);

但是我想使用一些编辑器,因为这是手工编写的可怕。我正在寻找一个编辑器,但我找不到它。

But I would like to use some editor for this because this is horrible to write by hand. I am searching for an editor but I can not find it.

推荐答案

我猜你继承了一些代码,对吧?我之所以这么说,因为 writeText()不是来自iTextSharp,它是某人特定的实现,它包含了iTextSharp的代码。

I'm guessing that you inherited some code, right? I say that because writeText() is not from iTextSharp, it is someone's specific implementation that wraps around iTextSharp's code.

iTextSharp是一个最终生成PDF的库,因此受PDF规范的约束。这首先是最重要的事情。即使你已经知道这一点,你也必须始终牢记这一点。

iTextSharp is a library that ultimately produces PDFs and as such is bound by the PDF specification. This is first and foremost the most important thing to understand. Even if you already know this you must always keep this top of mind.

iText以两种基本模式运行,1)完全抽象,你添加段落和表格 和2)手动放置模式,你说在这个坐标上使用这个字体写这个文字,不用担心,我已经测量了所有内容,所以我知道在哪里插入换行符,所以它看起来并不奇怪。

iText runs in two basic modes, 1) full abstraction where you add "paragraphs" and "tables" and 2) manual placement mode where you say "write this text using this font at this coordinate and don't worry, I've measured everything so I know where to insert line breaks so it doesn't look weird."

完全抽象模式(我的术语,不是他们的)使用文档对象并创建新的段落对象和将添加到文档,iText会为您计算剩下的部分。控制较少,但如果你可以在这种模式下生活,你的生活将变得更加容易。

Full abstraction mode (my terminology, not their's) uses the Document object and you create new Paragraph objects and Add them to the Document and iText figures the rest out for you. There's less control but if you can live in this mode your live will be so much easier.

手动放置模式(再次,我的术语,而不是他们的)使用的实例 PdfWriter PdfContentByte 类发出更接近PDF规范的命令。使用此模式假设您至少部分阅读了规范。例如,您应该知道段落和表格实际上并不存在于PDF中。

Manual placement mode (once again, my terminology, not their's) uses instances of the PdfWriter and PdfContentByte classes to issue commands that are much closer to the PDF spec. Usage of this mode kind of assumes that you've at least partially read the spec. For instance, you'll should be aware that "paragraphs" and "tables" don't actually exist in a PDF.

您正在使用的变量, cb ,几乎肯定是 PdfContentByte 的一个实例,所以你使用的是手动放置模式。

The variable that you are using, cb, is almost definitely an instance of a PdfContentByte so you are using manual placement mode.

现在回答你的问题。

不,没有GUI程序可以编辑特定于iTextSharp的代码。但是,Adobe Acrobat,Adobe Illustrator和Adobe InDesign等程序确实知道如何使用PDF。那里也可能有免费的。您可以使用这些程序,找到事物的x,y坐标并手动将它们写入您的代码。

No, there are no GUI programs to edit code that's specific to iTextSharp. However, there are programs such as Adobe Acrobat, Adobe Illustrator and Adobe InDesign that do know how to work with PDFs. There are probably free ones out there, too. You can use these programs, find the x,y coordinates of things and manually write those into your code.

这篇关于用于创建标签的itextsharp编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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