Advertisement
Guest User

ss

a guest
Aug 21st, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.95 KB | None | 0 0
  1. PdfDocument document = new PdfDocument();
  2. PdfPage page = document.AddPage();
  3. XGraphics gfx = XGraphics.FromPdfPage(page);
  4. XFont fontÜberschrift = new XFont("Arial", 17, XFontStyle.Bold);
  5. XFont fontArial = new XFont("Arial", 10, XFontStyle.Regular);
  6. XFont fontDEMO = new XFont("Arial", 30, XFontStyle.Bold);
  7. XTextFormatter tf = new XTextFormatter(gfx);
  8.  
  9. //Aufbau des Footers
  10. XPen pen = new XPen(XColors.Black, 2);
  11. XPen penSmall = new XPen(XColors.Black, 0.5);
  12.  
  13. //Rechteck Außen
  14. gfx.DrawLine(pen, 40, 40, 40, 800); //Oben nach unten
  15. gfx.DrawLine(pen, 40, 800, 550, 800); //Unten nach rechts
  16. gfx.DrawLine(pen, 550, 40, 550, 800); //Rechts nach unten
  17. gfx.DrawLine(pen, 40, 40, 550, 40); //Oben nach Rechts
  18.  
  19. //Footer
  20. gfx.DrawLine(pen, 40, 710, 550, 710); //Querlinie oben
  21. gfx.DrawLine(penSmall, 40, 755, 550, 755); //Querlinie Mitte
  22. gfx.DrawLine(penSmall, 40, 770, 320, 770); //Obere Halbe Querlinie
  23. gfx.DrawLine(penSmall, 40, 785, 320, 785); //Untere Halbe Querlinie
  24. gfx.DrawLine(penSmall, 90, 710, 90, 800); //Vertikal Linie Links
  25. gfx.DrawLine(penSmall, 320, 710, 320, 800); //Vertikal Linie Rechts
  26. gfx.DrawLine(penSmall, 200, 755, 200, 800); //Vertikal Halbe Linie Mitte
  27.  
  28. //Kundendaten
  29. XRect rectKunde = new XRect(40, 711, 50, 44);
  30. gfx.DrawRectangle(penSmall, rectKunde);
  31. tf.DrawString(" Kunde:", fontArial, XBrushes.Black, rectKunde, XStringFormats.TopLeft);
  32. XRect rectName = new XRect(90, 711, 230, 11);
  33. gfx.DrawRectangle(penSmall, rectName);
  34. tf.DrawString(" " + textBox_Panel_Montageadresse_Name.Text, fontArial, XBrushes.Black, rectName, XStringFormats.TopLeft);
  35. XRect rectName2 = new XRect(90, 722, 230, 11);
  36. gfx.DrawRectangle(penSmall, rectName2);
  37. tf.DrawString(" " + textBox_Panel_Montageadresse_Name2.Text, fontArial, XBrushes.Black, rectName2, XStringFormats.TopLeft);
  38. XRect rectStraße = new XRect(90, 733, 230, 11);
  39. gfx.DrawRectangle(penSmall, rectStraße);
  40. tf.DrawString(" " + textBox_Panel_Montageadresse_Strasse.Text, fontArial, XBrushes.Black, rectStraße, XStringFormats.TopLeft);
  41. XRect rectOrt = new XRect(90, 744, 230, 11);
  42. gfx.DrawRectangle(penSmall, rectOrt);
  43. tf.DrawString(" " + textBox_Panel_Montageadresse_Ort.Text, fontArial, XBrushes.Black, rectOrt, XStringFormats.TopLeft);
  44.  
  45. //Montagedaten
  46. XRect rectMontage = new XRect(90, 755, 110, 15);
  47. gfx.DrawRectangle(penSmall, rectMontage);
  48. tf.DrawString(" Montage:", fontArial, XBrushes.Black, rectMontage, XStringFormats.TopLeft);
  49. XRect rectAenderung = new XRect(200, 755, 120, 15);
  50. gfx.DrawRectangle(penSmall, rectAenderung);
  51. tf.DrawString(" Änderung:", fontArial, XBrushes.Black, rectAenderung, XStringFormats.TopLeft);
  52. XRect rectDatum = new XRect(40, 770, 50, 15);
  53. gfx.DrawRectangle(penSmall, rectDatum);
  54. tf.DrawString(" Datum:", fontArial, XBrushes.Black, rectDatum, XStringFormats.TopLeft);
  55. XRect rectTechniker = new XRect(40, 785, 50, 15);
  56. gfx.DrawRectangle(penSmall, rectTechniker);
  57. tf.DrawString(" Techniker:", fontArial, XBrushes.Black, rectTechniker, XStringFormats.TopLeft);
  58. XRect rectDatumText = new XRect(90, 770, 110, 15);
  59. gfx.DrawRectangle(penSmall, rectDatumText);
  60. tf.DrawString(" " + textBox_Panel_Montage.Text, fontArial, XBrushes.Black, rectDatumText, XStringFormats.TopLeft);
  61. XRect rectTechnikerText = new XRect(90, 785, 110, 15);
  62. gfx.DrawRectangle(penSmall, rectTechnikerText);
  63. tf.DrawString(" " + textBox_Panel_Techniker.Text, fontArial, XBrushes.Black, rectTechnikerText, XStringFormats.TopLeft);
  64.  
  65. //Header
  66. XImage imageBosch_Logo = XImage.FromGdiPlusImage(Resources.Bosch_Logo);
  67. XRect rect = new XRect(60, 55, 220, 20);
  68. gfx.DrawRectangle(XBrushes.White, rect);
  69. tf.DrawString("Bosch Sicherheitssysteme GmbH", fontÜberschrift, XBrushes.Black, rect, XStringFormats.TopLeft);
  70. gfx.DrawImage(imageBosch_Logo, 435, 50, 99, 30);
  71.  
  72. //Aufbau MAP Modul
  73. XImage imageMAP5000Modul = XImage.FromGdiPlusImage(Resources.MAP5000Modul);
  74. gfx.DrawImage(imageMAP5000Modul, 220, 85, 320, 620);
  75. XRect rect1 = new XRect(60, 156, 158, 55);
  76. gfx.DrawRectangle(penSmall, rect1);
  77. tf.DrawString("MAP Data BUS", fontArial, XBrushes.Black, rect1, XStringFormats.TopLeft);
  78. XRect rect2 = new XRect(60, 213, 158, 33);
  79. gfx.DrawRectangle(penSmall, rect2);
  80. tf.DrawString(MAP_Ausgang1, fontArial, XBrushes.Black, rect2, XStringFormats.TopLeft);
  81. XRect rect3 = new XRect(60, 246, 158, 33);
  82. gfx.DrawRectangle(penSmall, rect3);
  83. tf.DrawString(MAP_Ausgang2, fontArial, XBrushes.Black, rect3, XStringFormats.TopLeft);
  84. XRect rect4 = new XRect(60, 282, 158, 47);
  85. gfx.DrawRectangle(penSmall, rect4);
  86. tf.DrawString(MAP_Relais1, fontArial, XBrushes.Black, rect4, XStringFormats.TopLeft);
  87. XRect rect5 = new XRect(60, 330, 158, 47);
  88. gfx.DrawRectangle(penSmall, rect5);
  89. tf.DrawString(MAP_Relais2, fontArial, XBrushes.Black, rect5, XStringFormats.TopLeft);
  90. XRect rect6 = new XRect(60, 378, 158, 32);
  91. gfx.DrawRectangle(penSmall, rect6);
  92. tf.DrawString(MAP_Spannung, fontArial, XBrushes.Black, rect6, XStringFormats.TopLeft);
  93. XRect rect7 = new XRect(60, 411, 158, 23);
  94. gfx.DrawRectangle(penSmall, rect7);
  95. tf.DrawString(MAP_ML1, fontArial, XBrushes.Black, rect7, XStringFormats.TopLeft);
  96. XRect rect8 = new XRect(60, 435, 158, 23);
  97. gfx.DrawRectangle(penSmall, rect8);
  98. tf.DrawString(MAP_ML2, fontArial, XBrushes.Black, rect8, XStringFormats.TopLeft);
  99. XRect rect9 = new XRect(60, 459, 158, 23);
  100. gfx.DrawRectangle(penSmall, rect9);
  101. tf.DrawString(MAP_ML3, fontArial, XBrushes.Black, rect9, XStringFormats.TopLeft);
  102. XRect rect10 = new XRect(60, 483, 158, 23);
  103. gfx.DrawRectangle(penSmall, rect10);
  104. tf.DrawString(MAP_ML4, fontArial, XBrushes.Black, rect10, XStringFormats.TopLeft);
  105. XRect rect11 = new XRect(60, 507, 158, 23);
  106. gfx.DrawRectangle(penSmall, rect11);
  107. tf.DrawString(MAP_ML5, fontArial, XBrushes.Black, rect11, XStringFormats.TopLeft);
  108. XRect rect12 = new XRect(60, 531, 158, 23);
  109. gfx.DrawRectangle(penSmall, rect12);
  110. tf.DrawString(MAP_ML6, fontArial, XBrushes.Black, rect12, XStringFormats.TopLeft);
  111. XRect rect13 = new XRect(60, 555, 158, 23);
  112. gfx.DrawRectangle(penSmall, rect13);
  113. tf.DrawString(MAP_ML7, fontArial, XBrushes.Black, rect13, XStringFormats.TopLeft);
  114. XRect rect14 = new XRect(60, 579, 158, 23);
  115. gfx.DrawRectangle(penSmall, rect14);
  116. tf.DrawString(MAP_ML8, fontArial, XBrushes.Black, rect14, XStringFormats.TopLeft);
  117. XRect rect15 = new XRect(60, 603, 158, 32);
  118. gfx.DrawRectangle(penSmall, rect15);
  119. tf.DrawString(MAP_DK, fontArial, XBrushes.Black, rect15, XStringFormats.TopLeft);
  120.  
  121. document.Save(sfd.FileName);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement