使用“graphics.DrawString”后如何提高打印文本质量? [英] how to improve printed text quality after using “graphics.DrawString”?

查看:191
本文介绍了使用“graphics.DrawString”后如何提高打印文本质量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打印后我的文字质量有问题!它不顺畅和抗锯齿!



这是故事:



我用位图创建图形(Graphics.FromImage(MyBitmap))我觉得这是我问题的起点,因为我不能使用PrintPageEvenArg(e),但我别无选择!



之后我开始在这个图形上写一些文字:



通过阅读本网站和其他一些类似问题的答案,我对我的图形进行了一些更改诸如smoothingMode,TextRenderingHint等属性......你在继续看到......但不幸的是,他们都没有帮助我!



I have a problem with my text quality after printing ! it's not smooth and antialiases!

This is the story :

I create a graphic from a bitmap (Graphics.FromImage(MyBitmap)) and I think it's the start point of my problem because I can't use PrintPageEvenArg(e) , but I have no other choice!

after that I begin writing some text on this graphic:

by reading the answers of similar Questions in this site and some others , I made some changes on my graphics properties such as smoothingMode , TextRenderingHint , ... that U see in continue... but unfortunately none of them helped me !

SolidBrush sb = new SolidBrush(Color.White);
  graphics.FillRectangle(sb,oRectangle); //it was suggested to be done before antialiases inorder to get effects

  graphics.TextRenderingHint = TextRenderingHint.AntiAlias; //I also tried ClearTypeGridFit
  graphics.SmoothingMode =
        System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
  graphic.PixelOffsetMode = PixelOffsetMode.HighQuality;
  graphic.CompositingQuality = CompositingQuality.HighQuality;
  graphic.CompositingMode = CompositingQuality.SourceOver;

  Graphics.DrawString(strValue, boxStyle.Font, sb, oRectangle, StringFormat);

<

by antialising我得到了更好的平滑边缘但是我在文本附近看到了很多额外的像素,我的文字颜色似乎变得更亮所以我可以说通过平滑边缘我的文字质量甚至变得更糟!



我还使用了不同的图像格式,如png,jpg,bmp,...但没有帮助!



plz帮助我! Thanx提前:)

<
by antialising I got better smooth edge but I see a lot of extra pixel near my text and my text color seems to become lighter so I can say that by smoothing edge my text quality even got worse !

I also used different image Formats such as png , jpg , bmp , ... but not helped!

plz help me ! Thanx in advance :)

推荐答案

目前还不完全清楚你在做什么,所以你是说你正在将这个文字写入图像然后打印出来图片??



是的,这会严重搞砸你做的任何走样。为什么?



因为你正在使用的图像是96 DPI,当你在能够分辨率更高的东西上打印图像时,比如1600 DPI打印机,图像正在被放大(放大)。



如果你在显示器上显示你的位图,那就是2英寸宽。当您以原始分辨率在打印机上打印96 DPI图像时,该图像现在不到四分之一英寸宽。您必须放大图像,因此每个像素,以使其在打印机上再次宽2英寸。



每个像素距离为.010英寸宽在显示器上打印机的宽度为.000625英寸。使用放大倍率将每个像素恢复到.010,你必须将图像中每个像素的宽度乘以16倍。这只是消除了你的抗锯齿。
It's not entirely clear what you're doing, so are you saying that you're writing this text to an image and then printing the image??

Yeah, that's going to severely screw up any aliasing you do. Why??

Because the image that you're drawing on is 96 DPI and when you print that image on something capable of far greater resolution, say a 1600 DPI printer, the image is being blown up (magnified).

If you show your bitmap on the display, it's say, 2 inches wide. When you print that 96 DPI image on a printer in its native resolution, that image is now less than a quarter inch wide. You have to magnify the image, and therefore every pixel, to get it to be 2 inches wide again on the printer.

Every pixel goes from being .010 inches wide on your monitor to being .000625 inches wide on your printer. With the magnification to get each pixel back up to .010, you have to multiply the width of every pixel in the image by a factor of 16. That just wiped out your anti-aliasing.


使用此:



graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

graphics.DrawString(... < br $> b $ b

为我工作
Use this:

graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
graphics.DrawString(...

worked for me


这篇关于使用“graphics.DrawString”后如何提高打印文本质量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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