寻找用于打印的轻量级文档描述语言
我正在寻找一种非常轻量级的文档描述语言,可以用C轻松解析它。目的是打印类似于收银机收据的小文档或标签。 我只需要基本的格式化功能来进行字体设置、对齐和插入预定义变量。
有任何想法吗? 使用 rtf 的某些子集是一个不错的选择吗?
I'm looking for a very lightweight document description language, which can be easyly parsed in C. The purpose is printing of small documents or labels similar to cash register receipts. I need only basic formatting features for font settings, alignment and insertion of predefined variables.
Any ideas?
Would using of some subset of rtf be a good choice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(5)
Microsoft 定义了专为小型报告、收据等设计的报告定义语言。 Visual Studio 可以创建 RDL 文件,但它是一个开放标准,并且有 RDL 报告生成器的开源实现。
Microsoft has defined a Report Definition Language designed for small reports, receipts, and such. Visual Studio can create RDL files, but it is an open standard and there are open source implementations of RDL report generators.
我想说的是,选择基于 XML 的东西(大量良好的快速预制解析器,包括纯 C 语言),并且可能是 XHTML Transitional 的一个小子集,以免重新发明轮子 -
等等。 RTF 并不是真的更容易解析,而是非常不人性化。
I'd say go for something XML-based (plenty of good fast premade parsers, including for plain C), and probably a tiny subset of XHTML Transitional so as not to reinvent the wheel -
<font name="..." color="...">
and such. RTF is not really much easier to parse, but is very human unfriendly.我建议看看 gd 库。 只需自己创建一种简单的脚本语言,每行一个 GD 命令即可。
I suggest to have a look at the gd library. Just create a simple script language yourself with one GD command per line.
如果您的需求更高级,也会投票支持 XML,也许还有 XPS
Would also vote for XML and maybe XPS, if your needs are more advanced
为什么不使用 Stackoverflow 的标记语言 Markdown 呢?
Why not Markdown, the markup language of Stackoverflow?