c# - Alternatives for languages that ad sense doesn't support -
introduction:
i working local website displays local contents in local language.
problem:
unfortunately local language not supported google ads per:
so 1 way thought convert text/string image , display images instead.(server side)
question
i using c# method convert text image. dont understand implementation multi-line text?
or there better way support languages ad sense doesn't support without images?
c# code
string text = str.trim(); bitmap bitmap = new bitmap(1, 1); font font = new font("arial", 12, fontstyle.regular, graphicsunit.pixel); graphics graphics = graphics.fromimage(bitmap); int width = (int)graphics.measurestring(text, font).width; int height = (int)graphics.measurestring(text, font).height; bitmap = new bitmap(bitmap, new size(width, height)); graphics = graphics.fromimage(bitmap); graphics.clear(color.white); graphics.smoothingmode = smoothingmode.antialias; graphics.textrenderinghint = textrenderinghint.antialias; graphics.drawstring(text, font, new solidbrush(color.fromargb(255, 0, 0)), 0, 0); graphics.flush(); graphics.dispose(); string filename = path.getfilenamewithoutextension(path.getrandomfilename()) + ".jpg"; bitmap.save(server.mappath("~/app_images/") +"11"+filename, imageformat.jpeg); //imgtext.imageurl = "~/images/" + filename; //imgtext.visible = true; return "~/app_images/my_converted.jpg";
if have idea type of problem or refrence/link, please help. time.
in c# can put newline (\r\n) in string.
i edited question more appealing , relevant wider audience. please leave question unmarked while hear more ideas, cheers!
Comments
Post a Comment