@@ -47,11 +47,16 @@ const renderSection = (doc, yPosition, margin, pageWidth, contentWidth, title, d
4747 doc . setFontSize ( sectionTitleFontSize ) ;
4848 doc . setFont ( 'helvetica' , 'bold' ) ;
4949 yPosition = addText ( doc , title , margin , yPosition ) ;
50- yPosition += 2 ;
5150
51+ doc . setDrawColor ( 150 ) ;
5252 doc . setLineWidth ( 0.5 ) ;
53- doc . line ( margin , yPosition , pageWidth - margin , yPosition ) ;
54- yPosition += 3 ;
53+ doc . line ( margin , yPosition , margin + contentWidth , yPosition ) ;
54+
55+ yPosition += 4 ; // uniform gap after the line
56+
57+ doc . setLineWidth ( 0.5 ) ;
58+
59+ yPosition += 6 ; // more breathing space
5560
5661 doc . setFont ( 'helvetica' , 'normal' ) ;
5762
@@ -79,16 +84,16 @@ const renderSection = (doc, yPosition, margin, pageWidth, contentWidth, title, d
7984
8085 return yPosition ;
8186} ;
82-
8387export const generateResumePdf = ( resumeData , setIsGenerating ) => {
8488 setIsGenerating ( true ) ;
8589
8690 try {
8791 const doc = new jsPDF ( 'p' , 'mm' , 'a4' ) ;
88- const margin = 15 ;
92+ const margin = 10 ;
8993 let yPosition = margin ;
9094 const pageWidth = doc . internal . pageSize . getWidth ( ) ;
9195 const contentWidth = pageWidth - 2 * margin ;
96+
9297 const bodyFontSize = 10 ;
9398 const wrappedLineHeight = 3.5 ;
9499 const linkColorHex = '#007bff' ;
@@ -192,11 +197,11 @@ export const generateResumePdf = (resumeData, setIsGenerating) => {
192197
193198 doc . setFont ( 'helvetica' , 'bold' ) ;
194199 currentY = addText ( doc , `${ category . title } :` , margin , currentY ) ;
195- currentY += 1 ;
200+ currentY += 1 ; // gap after title
196201
197202 doc . setFont ( 'helvetica' , 'normal' ) ;
198203 currentY = addWrappedText ( doc , category . content , margin , currentY , contentWidth , wrappedLineHeight ) ;
199- currentY += 4 ;
204+ currentY += 4 ; // additional gap after content
200205 }
201206 } ) ;
202207 return currentY ;
@@ -235,8 +240,9 @@ export const generateResumePdf = (resumeData, setIsGenerating) => {
235240
236241 doc . setFont ( 'helvetica' , 'normal' ) ;
237242 if ( exp . workDescription ) {
238- currentY += 2 ;
243+ currentY += 2 ; // gap before work description
239244 currentY = addWrappedText ( doc , exp . workDescription , margin , currentY , contentWidth , wrappedLineHeight ) ;
245+ currentY += 6 ; // gap after work description
240246 }
241247 return currentY ;
242248 } ,
@@ -326,6 +332,7 @@ export const generateResumePdf = (resumeData, setIsGenerating) => {
326332 }
327333 doc . setFontSize ( oldFontSize ) ;
328334 doc . setFont ( 'helvetica' , 'normal' ) ;
335+ currentY += 6 ; // gap after links
329336 }
330337 return currentY ;
331338 } ,
@@ -362,6 +369,7 @@ export const generateResumePdf = (resumeData, setIsGenerating) => {
362369 } ) ;
363370 doc . setFont ( 'helvetica' , 'normal' ) ;
364371 doc . setFontSize ( bodyFontSize ) ;
372+ currentY += 6 ; // gap before description
365373
366374 return currentY ;
367375 } ,
@@ -438,7 +446,7 @@ export const generateResumePdf = (resumeData, setIsGenerating) => {
438446 } else if ( ! detailsAdded ) {
439447 currentY -= 2 ;
440448 }
441-
449+ currentY += 6 ; // gap after leadership section
442450 return currentY ;
443451 } ,
444452 ) ;
@@ -473,6 +481,12 @@ export const generateResumePdf = (resumeData, setIsGenerating) => {
473481 } ) ;
474482 return currentY - 2 ;
475483 }
484+ // If no achievements, return currentY without adding anything
485+ if ( currentY > y ) {
486+ currentY -= 2 ; // Adjust for the last gap
487+ } else {
488+ currentY = y ; // Reset to original position if no achievements
489+ }
476490 return currentY ;
477491 } ,
478492 ) ;
0 commit comments