Attorney Service Fee Estimator

Attorney Service Fee Estimator

Generate an estimated cost for common legal services.

This is a non-binding estimate for informational purposes only. Actual fees may vary.

'; detailsContainer.innerHTML = detailsHtml; resultsContainer.classList.remove('hidden'); setTimeout(() => { resultsContainer.classList.remove('opacity-0', '-translate-y-4'); }, 10); } // --- PDF GENERATION --- async function generatePdf() { const { jsPDF } = window.jspdf; const pdfContent = document.getElementById('pdf-content'); // Temporarily add a border for better visual separation in PDF pdfContent.classList.add('border-2', 'p-4'); try { const canvas = await html2canvas(pdfContent, { scale: 2 }); pdfContent.classList.remove('border-2', 'p-4'); // Remove the border after canvas is created const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const margin = 40; const contentWidth = pdfWidth - (2 * margin); const imgProps = pdf.getImageProperties(imgData); const contentHeight = (imgProps.height * contentWidth) / imgProps.width; pdf.setFontSize(24); pdf.text("Attorney Service Fee Estimate", pdfWidth / 2, margin, { align: 'center' }); pdf.setFontSize(12); pdf.text(`Generated on: ${lastCalculation.date}`, pdfWidth / 2, margin + 20, { align: 'center' }); pdf.addImage(imgData, 'PNG', margin, margin + 40, contentWidth, contentHeight); pdf.save('Attorney_Fee_Estimate.pdf'); } catch (error) { console.error('Error generating PDF:', error); alert('An error occurred while creating the PDF.'); pdfContent.classList.remove('border-2', 'p-4'); // Ensure border is removed on error } } // --- START THE APP --- initializeTool(); });
Scroll to Top