From 8ce4971186665c39c90344ae525916924ba478c4 Mon Sep 17 00:00:00 2001 From: Deepika Date: Wed, 15 Apr 2026 11:56:15 +0530 Subject: [PATCH] Removed the unused variable in helper method --- Videos/QRCode/QRCode/Controllers/HomeController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Videos/QRCode/QRCode/Controllers/HomeController.cs b/Videos/QRCode/QRCode/Controllers/HomeController.cs index 06448d70..773f8b71 100644 --- a/Videos/QRCode/QRCode/Controllers/HomeController.cs +++ b/Videos/QRCode/QRCode/Controllers/HomeController.cs @@ -136,6 +136,7 @@ public IActionResult QRWithLogo() public IActionResult QRToHeader() { + // Create a new PDF document instance PdfDocument document = new PdfDocument(); //Add page to the document @@ -150,10 +151,13 @@ public IActionResult QRToHeader() //Read the text from the text file string text = System.IO.File.ReadAllText("data\\input.txt"); + // Create a standard Helvetica font with size 12 PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12); + // Create a text element using the file content and fon PdfTextElement element = new PdfTextElement(text, font); + // Draw the text element on the PDF page element.Draw(page, new PointF(0, 0)); // Create a memory stream to hold the output PDF @@ -178,13 +182,9 @@ PdfPageTemplateElement CreateHeaderTemplate(SizeF headerSize) //Create PdfPageTemplateElement PdfPageTemplateElement header = new PdfPageTemplateElement(new RectangleF(0, 0, headerSize.Width, headerSize.Height)); - string headerText = "PDF Succinctly"; - + // Create a font for the header text PdfStandardFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 16, PdfFontStyle.Regular); - //Measure the text size - SizeF textSize = font.MeasureString(headerText); - //Draw the text with center alignment header.Graphics.DrawString("PDF Succinctly", font, PdfBrushes.Black, new PointF(0, (headerSize.Height - font.Height) / 2));