Breastfeeding & Lactation Support Guide

Breastfeeding & Lactation Support Guide

A gentle guide to help you navigate your breastfeeding journey with confidence.

Mastering the Latch

A good latch is the foundation of comfortable and effective breastfeeding. Here are some tips to help you and your baby get it right. Select the tips you want to add to your plan.

You haven't selected any tips yet. Go through the other tabs to build your plan!

`; elements.downloadPdfBtn.style.display = 'none'; } else { elements.downloadPdfBtn.style.display = 'inline-flex'; } elements.planResultContainer.innerHTML = planHTML; }; // --- PDF Generation --- const downloadPDF = () => { if (typeof window.jspdf === 'undefined') { alert('Could not generate PDF. The required library is missing.'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); const colors = { primary: '#8b5cf6', secondary: '#a78bfa', textPrimary: '#1f2937', textSecondary: '#6b7280' }; doc.setFillColor(colors.primary); doc.rect(0, 0, 210, 28, 'F'); doc.setFont('helvetica', 'bold'); doc.setFontSize(20); doc.setTextColor('#FFFFFF'); doc.text('My Breastfeeding Support Plan', 105, 18, { align: 'center' }); let yPos = 40; doc.setFontSize(11); doc.setFont('helvetica', 'normal'); doc.setTextColor(colors.textPrimary); doc.text('This personalized guide contains the tips you selected. Remember, every journey is unique.', 14, yPos); yPos += 15; Object.keys(myPlan).forEach(category => { if (myPlan[category].length > 0) { if (yPos > 250) { doc.addPage(); yPos = 20; } const categoryTitle = category.charAt(0).toUpperCase() + category.slice(1); doc.setFontSize(16); doc.setFont('helvetica', 'bold'); doc.setTextColor(colors.primary); doc.text(`${categoryTitle} Tips`, 14, yPos); yPos += 8; myPlan[category].forEach(tip => { // Remove HTML tags for PDF const cleanTip = tip.replace(/<[^>]*>?/gm, ''); doc.setFontSize(11); doc.setFont('helvetica', 'normal'); doc.setTextColor(colors.textPrimary); const splitTip = doc.splitTextToSize(`• ${cleanTip}`, 180); doc.text(splitTip, 20, yPos); yPos += (splitTip.length * 5) + 3; }); yPos += 5; } }); yPos = Math.max(yPos, 275); doc.setDrawColor(colors.secondary); doc.line(14, yPos, 196, yPos); doc.setFontSize(9); doc.setFont('helvetica', 'italic'); doc.setTextColor(colors.textSecondary); doc.text('This guide provides general information and is not a substitute for professional medical advice. Consult an IBCLC or healthcare provider for personalized support.', 105, yPos + 8, { align: 'center', maxWidth: 180 }); doc.save('My_Breastfeeding_Plan.pdf'); }; // --- Event Listeners --- elements.downloadPdfBtn.addEventListener('click', downloadPDF); // --- Initialization --- // Initial render for the plan tab in case it's clicked first renderPlan(); });
Scroll to Top