Backlink Suggestion Tool

Impact: ${suggestion.impact}

`; const borderColor = { "Low": "#10b981", "Medium": "#f59e0b", "High": "#ef4444", "Very High": "#dc2626" }; card.style.borderLeftColor = borderColor[suggestion.impact] || '#64748b'; suggestionsList.appendChild(card); }); suggestionsOutput.classList.remove('hidden'); pdfButtonContainer.classList.remove('hidden'); }; const handlePdfDownload = () => { if (!lastSuggestions) return; const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const margin = 50; const pageWidth = pdf.internal.pageSize.getWidth(); let yPos = margin; pdf.setFontSize(24); pdf.setFont('Helvetica', 'bold'); pdf.text("Backlink Suggestion Report", pageWidth / 2, yPos, { align: 'center' }); yPos += 20; pdf.setFontSize(14); pdf.setFont('Helvetica', 'normal'); pdf.text(`Keyword: "${keywordInput.value}"`, pageWidth / 2, yPos, { align: 'center' }); yPos += 40; lastSuggestions.forEach(suggestion => { if (yPos > pdf.internal.pageSize.getHeight() - 100) { pdf.addPage(); yPos = margin; } pdf.setFontSize(16); pdf.setFont('Helvetica', 'bold'); pdf.text(suggestion.type, margin, yPos); yPos += 20; pdf.setFontSize(10); pdf.setFont('Helvetica', 'normal'); const strategyLines = pdf.splitTextToSize(`Strategy: ${suggestion.strategy}`, pageWidth - margin * 2); pdf.text(strategyLines, margin, yPos); yPos += strategyLines.length * 12 + 10; pdf.text(`Example Target: ${suggestion.target}`, margin, yPos); yPos += 20; pdf.text(`Difficulty: ${suggestion.difficulty} | Impact: ${suggestion.impact}`, margin, yPos); yPos += 25; pdf.setDrawColor(220, 220, 220); pdf.line(margin, yPos, pageWidth - margin, yPos); yPos += 20; }); const today = new Date().toLocaleDateString('en-US'); const pageHeight = pdf.internal.pageSize.getHeight(); pdf.setFontSize(9); pdf.setTextColor(150); pdf.text(`Generated on ${today}`, margin, pageHeight - 30); pdf.save('backlink-suggestions.pdf'); }; generateBtn.addEventListener('click', generateSuggestions); downloadPdfBtn.addEventListener('click', handlePdfDownload); keywordInput.addEventListener('keypress', (e) => { if(e.key === 'Enter') { generateSuggestions(); } }); // Initial generation on load generateSuggestions(); });
Scroll to Top