@@ -136,6 +136,7 @@ public IActionResult QRWithLogo()
136136
137137 public IActionResult QRToHeader ( )
138138 {
139+ // Create a new PDF document instance
139140 PdfDocument document = new PdfDocument ( ) ;
140141
141142 //Add page to the document
@@ -150,10 +151,13 @@ public IActionResult QRToHeader()
150151 //Read the text from the text file
151152 string text = System . IO . File . ReadAllText ( "data\\ input.txt" ) ;
152153
154+ // Create a standard Helvetica font with size 12
153155 PdfFont font = new PdfStandardFont ( PdfFontFamily . Helvetica , 12 ) ;
154156
157+ // Create a text element using the file content and fon
155158 PdfTextElement element = new PdfTextElement ( text , font ) ;
156159
160+ // Draw the text element on the PDF page
157161 element . Draw ( page , new PointF ( 0 , 0 ) ) ;
158162
159163 // Create a memory stream to hold the output PDF
@@ -178,13 +182,9 @@ PdfPageTemplateElement CreateHeaderTemplate(SizeF headerSize)
178182 //Create PdfPageTemplateElement
179183 PdfPageTemplateElement header = new PdfPageTemplateElement ( new RectangleF ( 0 , 0 , headerSize . Width , headerSize . Height ) ) ;
180184
181- string headerText = "PDF Succinctly" ;
182-
185+ // Create a font for the header text
183186 PdfStandardFont font = new PdfStandardFont ( PdfFontFamily . Helvetica , 16 , PdfFontStyle . Regular ) ;
184187
185- //Measure the text size
186- SizeF textSize = font . MeasureString ( headerText ) ;
187-
188188 //Draw the text with center alignment
189189 header . Graphics . DrawString ( "PDF Succinctly" , font , PdfBrushes . Black , new PointF ( 0 , ( headerSize . Height - font . Height ) / 2 ) ) ;
190190
0 commit comments