Caloric Deficit Meal Plan Generator

Caloric Deficit Meal Plan Generator

Enter your target calories to generate a sample 3-day meal plan.

For Informational Purposes Only

This tool provides a sample meal plan. It is not a substitute for professional medical or nutritional advice. Calorie and macronutrient values are estimates. Consult with a registered dietitian or healthcare provider to create a plan tailored to your specific needs.

${mealType}: ${food.name}

~${food.calories} kcal | P: ${food.p}g, C: ${food.c}g, F: ${food.f}g

`; } function calculateTotalCalories(dayPlan) { let total = dayPlan.breakfast.calories + dayPlan.lunch.calories + dayPlan.dinner.calories; dayPlan.snacks.forEach(snack => total += snack.calories); return total; } // --- PDF Generation --- function generatePdf() { if (!currentPlan) { alert('Please generate a meal plan first.'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); const pageWidth = doc.internal.pageSize.width; let yPos = 20; // Header doc.setFont('helvetica', 'bold'); doc.setFontSize(20); doc.setTextColor(44, 62, 80); doc.text('Your 3-Day Sample Meal Plan', pageWidth / 2, yPos, { align: 'center' }); yPos += 8; doc.setFont('helvetica', 'normal'); doc.setFontSize(12); doc.setTextColor(127, 140, 141); doc.text(`Target: ~${calorieTargetInput.value} calories per day`, pageWidth / 2, yPos, { align: 'center' }); yPos += 15; // Loop through each day currentPlan.forEach((dayPlan, index) => { const totalCalories = calculateTotalCalories(dayPlan); const allMeals = [ { type: 'Breakfast', ...dayPlan.breakfast }, { type: 'Lunch', ...dayPlan.lunch }, { type: 'Dinner', ...dayPlan.dinner }, ...dayPlan.snacks.map(s => ({ type: 'Snack', ...s })) ]; const tableData = allMeals.map(meal => [meal.type, meal.name, meal.calories, meal.p, meal.c, meal.f]); if (yPos > doc.internal.pageSize.height - 80) { // Page break check doc.addPage(); yPos = 20; } doc.autoTable({ startY: yPos, head: [[ { content: `Day ${index + 1} (Approx. ${totalCalories} kcal)`, colSpan: 6, styles: { halign: 'center', fillColor: [59, 130, 246] } } ], ['Meal', 'Food Item', 'Cals', 'P(g)', 'C(g)', 'F(g)']], body: tableData, theme: 'grid', headStyles: { textColor: 255, fontStyle: 'bold' }, columnStyles: { 0: { fontStyle: 'bold' }, 2: { halign: 'right' }, 3: { halign: 'right' }, 4: { halign: 'right' }, 5: { halign: 'right' }, } }); yPos = doc.autoTable.previous.finalY + 15; }); // Disclaimer Footer const disclaimerText = document.querySelector('.disclaimer-box p').textContent; const disclaimerLines = doc.splitTextToSize(disclaimerText, pageWidth - 28); doc.setFontSize(8); doc.setTextColor(150); doc.text(disclaimerLines, 14, doc.internal.pageSize.height - 20); doc.save('Caloric_Deficit_Meal_Plan.pdf'); } });
Scroll to Top