ABCpdf 将文本转换为图像

发布于 2024-12-04 21:54:07 字数 72 浏览 4 评论 0原文

我使用 ABCpdf 输出 pdf 文档。 EAN-13字体已成功用于条形码打印,我想将其转换为PDF文档上的图像。有什么想法吗?

I use ABCpdf to output pdf documents. The EAN-13 font is successfully used for barcode printing and I want to convert it to an image on the PDF document. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月牙弯弯 2024-12-11 21:54:07

如果它是简单的条形码字体,则嵌入该字体,然后添加文本。例如:

doc.Font = doc.EmbedFont(@"c:\myean13.ttf");
// check return value != 0
doc.AddText("12345");

如果您想要图像而不是嵌入字体,那么完成此操作后,您可以光栅化文档的部分并将其添加到新的 PDF 中。像这样的东西:

using (Bitmap bm = doc.Rendering.GetBitmap()) {
  otherDoc.AddImageObject(bm);
}

If it's a simple barcode font then embed the font and then add the text. Something like:

doc.Font = doc.EmbedFont(@"c:\myean13.ttf");
// check return value != 0
doc.AddText("12345");

If you want an image rather than an embedded font then after you've done this you can rasterize the section of the doc and add it to a new PDF. Something like this:

using (Bitmap bm = doc.Rendering.GetBitmap()) {
  otherDoc.AddImageObject(bm);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文