Proofreading Log Generator

Proofreading Log Generator

Proofreading Log Generator

Generated Proofreading Log

[Document Title]

Page / Section Error Type Correction Made Notes

Configure Log Details


Log Entries


${type}

${correction || 'N/A'}

${notes || ''}

`; logBody.appendChild(tableRow); entryCount++; } }); if (entryCount === 0) { logBody.innerHTML = `No log entries added.`; } // 3. Enable PDF button & switch to Dashboard pdfBtn.disabled = false; pdfBtn.classList.remove('disabled:opacity-50', 'disabled:cursor-not-allowed'); showTab(0); // Switch to the first tab (Dashboard) }); // --- PDF Download Logic --- pdfBtn.addEventListener('click', function() { if (this.disabled) return; const { jsPDF } = window.jspdf; const contentToCapture = document.getElementById('prlog-pdf-content'); // Capture the div containing title and table wrapper const originalBtnText = pdfBtn.textContent; pdfBtn.textContent = 'Generating...'; pdfBtn.disabled = true; html2canvas(contentToCapture, { scale: 2, backgroundColor: "#ffffff", // Use parent background onclone: (doc) => { doc.getElementById('prlog-pdf-content').style.display = 'block'; // Ensure table wrapper respects layout during capture doc.getElementById('prlog-table-wrapper').style.maxHeight = 'none'; doc.getElementById('prlog-table-wrapper').style.overflowY = 'visible'; } }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const margin = 15; // mm const imgProps = pdf.getImageProperties(imgData); const imgWidth = pdfWidth - (margin * 2); const imgHeight = (imgProps.height * imgWidth) / imgProps.width; let heightLeft = imgHeight; let position = margin; pdf.addImage(imgData, 'PNG', margin, position, imgWidth, imgHeight); heightLeft -= (pdfHeight - (margin * 2)); // Subtract first page height while (heightLeft > 0) { position = heightLeft - imgHeight + margin; // Calculate new top position for image slice pdf.addPage(); pdf.addImage(imgData, 'PNG', margin, position, imgWidth, imgHeight); heightLeft -= (pdfHeight - (margin * 2)); // Subtract page height } pdf.save('proofreading_log.pdf'); pdfBtn.textContent = originalBtnText; // pdfBtn.disabled = false; // Keep enabled }).catch(err => { console.error("PDF generation failed:", err); pdfBtn.textContent = originalBtnText; // pdfBtn.disabled = false; }).finally(() => { // Reset table wrapper style regardless of success/error logTableWrapper.style.maxHeight = '500px'; logTableWrapper.style.overflowY = 'auto'; }); }); // --- Initial Setup --- addLogEntryRow('Page 5', 'Spelling', 'Changed "recieve" to "receive"', 'Common typo'); addLogEntryRow('Introduction', 'Clarity/Wording', 'Rephrased the opening sentence for better flow.', ''); pdfBtn.disabled = true; // Disable PDF initially showTab(0); updateNavButtons(); // Call initially to set button states });
Scroll to Top