生成并打印ID卡时,模糊文本模糊、文本、ID、卡时

由网友(刷新我们的记录)分享简介:我生成通过.NET身份证,我有在那里,我必须使用粗体字为它是不情愿接受动态文本我插入显得那么模糊的问题。 我目前在做什么:抓取图像帧。抓住员工的照片。合并。创建从生成图像的新位图。添加两套文字上的位图(FontBrush颜色设置为黑色)的顶部。 保存在 PNG图像,并以最高的质量我可以得到的。有什么要做的时候产...

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

我目前在做什么:

抓取图像帧。 抓住员工的照片。 合并。 创建从生成图像的新位图。 添加两套文字上的位图(FontBrush颜色设置为黑色)的顶部。 保存在 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,这样打印机会直接读取的字体。通过这种方式,打印机不会尝试漆字体的边缘,并简单地打印以优化的方式文本。

详细信息: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.

podod条形码编辑打印软件V8.0官方版 条码生成器下载 下载

What I'm currently doing:

Grab the image "frame". Grab the employee's photograph. Merge them. Create a new bitmap from the generated image. Add two sets of text on top of the bitmap (FontBrush color set to Black). 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

阅读全文

相关推荐

最新文章