Bibliography Formatter

Bibliography Formatter

Add Raw Citation Text

Citation Manager (0)

Bibliography / Works Cited

Style: APA 7th Edition | Author: Researcher Name

No citations to display.

Style: | Author:
Generated by Bibliography Formatter on

No citations to display.

'; return; } // Sort alphabetically (case-insensitive for general text sorting) const sorted = [...citations].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())); const containerDiv = document.createElement('div'); containerDiv.className = 'citation-list-container'; sorted.forEach(citation => { const p = document.createElement('p'); p.className = 'citation-entry'; p.innerText = citation; containerDiv.appendChild(p); }); previewEl.appendChild(containerDiv); } function renderManagerList() { const managerLog = document.getElementById('citation-manager-log'); managerLog.innerHTML = ''; document.getElementById('citation-count').innerText = citations.length; citations.forEach((text, index) => { const div = document.createElement('div'); div.className = 'manager-item'; div.innerHTML = ` ${text.substring(0, 50)}... `; managerLog.appendChild(div); }); } // --- PDF Export --- function generatePDF() { if (citations.length === 0) { alert("Please add citations before generating the PDF."); return; } const template = document.getElementById('pdf-template'); const pdfOutputEl = document.getElementById('pdf-citation-output'); // 1. Fill List Content (Use Times New Roman/Serif and explicit indent CSS for print) pdfOutputEl.innerHTML = ''; const sorted = [...citations].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())); sorted.forEach(citation => { const p = document.createElement('p'); // Apply PDF-specific styles (e.g., 0.5in indent for a standard 12pt Times New Roman) p.style.cssText = "font-size: 12pt; text-indent: -0.5in; padding-left: 0.5in; margin-top: 0; margin-bottom: 5px;"; p.innerText = citation; pdfOutputEl.appendChild(p); }); // 2. Generate PDF template.style.display = 'block'; const opt = { margin: 0.8, // Set margins to mimic standard paper layout filename: 'Formatted_Bibliography.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2 }, jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' } }; html2pdf().set(opt).from(template).save().then(() => { template.style.display = 'none'; }); } return { switchTab, updateMeta, addCitation, deleteCitation, generatePDF }; })();
Scroll to Top