Guest User

Untitled

a guest
Jun 20th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Drawing;
  8. using System.Drawing.Imaging;
  9. //using System.Drawing.Drawing2D;
  10.  
  11. namespace testeimg
  12. {
  13. public partial class _Default : System.Web.UI.Page
  14. {
  15. private void Page_Load(object sender, EventArgs e)
  16. {
  17. // Set the page's content type to JPEG files
  18. // and clears all content output from the buffer stream.
  19. Response.ContentType = "image/jpeg";
  20. Response.Clear();
  21.  
  22. // Buffer response so that page is sent
  23. // after processing is complete.
  24. Response.BufferOutput = true;
  25. // Create a font style.
  26. Brush pincel = new SolidBrush(Color.Black);
  27.  
  28. Font fontNome = new Font("Courier New", 36, FontStyle.Bold | FontStyle.Italic);
  29.  
  30. Font fontEvento = new Font("Courier New", 24, FontStyle.Bold | FontStyle.Italic);
  31.  
  32. Font fontPalestra = new Font("Courier New", 12, FontStyle.Bold | FontStyle.Italic);
  33.  
  34.  
  35. // Create a bitmap and use it to create a
  36. // Graphics object.
  37. Bitmap bmp = new Bitmap( System.Drawing.Image.FromFile(Server.MapPath("Certificado.jpg")));
  38. Graphics g = Graphics.FromImage(bmp);
  39.  
  40. g.DrawString("Marcelo Pereira da Silva", fontNome, SystemBrushes.WindowText, new PointF( 100, 500));
  41. g.DrawString("Participou do evento online ...... - parte 1",fontEvento, SystemBrushes.WindowText, new PointF(100, 800));
  42. g.DrawString("com duaraçaõ de 2 horas, no dia ../../.., ás .. : .. h",fontEvento,SystemBrushes.WindowText, new PointF(100, 900));
  43. g.DrawString("Leroeouiuuiuir", fontPalestra, SystemBrushes.WindowText, new PointF(600, 1000));
  44. g.DrawString("testessteresvhgggggggggggggggggggggggggggggg", fontPalestra, SystemBrushes.WindowText, new PointF(600, 1050));
  45. g.DrawString("coisas do bancofggggggggggggggggggggggggggggggggggggggg ", fontPalestra, SystemBrushes.WindowText, new PointF(600, 1100));
  46. g.DrawString("finmdsfmsdfghghghghghghghghghghghghghghghghghghghghghhhhh", fontPalestra, SystemBrushes.WindowText, new PointF(600, 1150));
  47.  
  48. // Save the bitmap to the response stream and
  49. // convert it to JPEG format.
  50. bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
  51.  
  52. // Release memory used by the Graphics object
  53. // and the bitmap.
  54. g.Dispose();
  55. bmp.Dispose();
  56.  
  57.  
  58. // Send the output to the client.
  59. Response.Flush();
  60. }
  61.  
  62. }
  63. }
Add Comment
Please, Sign In to add comment