生成并打印ID卡时,模糊文本 [英] Blurry text when generating and printing an ID card

查看:215
本文介绍了生成并打印ID卡时,模糊文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我生成通过.NET身份证,我有在那里,我必须使用粗体字为它是不情愿接受动态文本我插入显得那么模糊的问题。

我目前在做什么:

  1. 抓取图像帧。
  2. 抓住员工的照片。
  3. 合并。
  4. 创建从生成图像的新位图。
  5. 添加两套文字上的位图(FontBrush颜色设置为黑色)的顶部。
  6. 保存在 PNG图像,并以最高的质量我可以得到的。

有什么要做的时候产生的图像,以提高对PVC的ID卡打印?

 公共TextOnImage AddText(字符串消息,字体字型,的PointF点)
    {
        使用(图形G = Graphics.FromImage(图片))
        {
            g.CompositingQuality = CompositingQuality.HighQuality;
            g.Smoothi​​ngMode = Smoothi​​ngMode.HighQuality;
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            //g.TextContrast = 0;
            //g.TextRenderingHint = TextRenderingHint.AntiAlias​​; <  - 仍然没有工作
            g.DrawString(消息,字体,刷机,点的StringFormat);
        }

        回到这一点;
    }
 

解决方案

虽然这帮助下,我最终生成的PDF,这样打印机会直接读取的字体。通过这种方式,打印机不会尝试漆字体的边缘,并简单地打印以优化的方式文本。

详细信息:<一href="http://stackoverflow.com/questions/5573150/overlay-text-over-an-image-background-and-convert-to-pdf">Overlay文字在图片的背景,并转换为PDF

I am generating ID cards via .NET and I am having a problem where the dynamic text I insert appears so blurry that I have to use a bold font for it to be begrudgingly accepted.

What I'm currently doing:

  1. Grab the image "frame".
  2. Grab the employee's photograph.
  3. Merge them.
  4. Create a new bitmap from the generated image.
  5. Add two sets of text on top of the bitmap (FontBrush color set to Black).
  6. Save the image in PNG and with the highest quality I can get.

Is there something to be done when generating the image to improve the printing on PVC ID cards?

    public TextOnImage AddText(string message, Font font, PointF point)
    {
        using (Graphics g = Graphics.FromImage(Image))
        {
            g.CompositingQuality = CompositingQuality.HighQuality;
            g.SmoothingMode = SmoothingMode.HighQuality;
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            //g.TextContrast = 0;
            //g.TextRenderingHint = TextRenderingHint.AntiAlias; <-- Still didn't work
            g.DrawString(message, font, Brush, point, StringFormat);
        }

        return this;
    }

解决方案

Although this helped, I ended up generating a PDF so the printer would read the font directly. This way, the printer doesn't try to "paint" the font's edges, and simply prints the text in an optimized way.

More information: Overlay text over an image background and convert to PDF

这篇关于生成并打印ID卡时,模糊文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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