JK UPDATE NEWS

Real News Real Life
Voice of the People of Jammu and Kashmir
Online Exam Tyari
Breaking News
Latest updates from Jammu | Kashmir | National | International | Politics | Business | Sports | Jobs & Careers

E-Paper

JK UPDATE NEWS

Automatic E-Paper Generator


Ready to generate today's E-Paper

It will automatically include the last 20 posts uploaded on jkupdatenews.com

JK UPDATE NEWS

DAILY DIGITAL EDITION www.jkupdatenews.com

REAL NEWS • REAL LIFE • VOICE OF JAMMU & KASHMIR

© JK UPDATE NEWS - This is an automatically generated e-paper based on recent web updates.
// Connecting to jkupdatenews.com feed...'; try { // 2. Fetching 20 Latest Posts // Hum ?alt=json use kar rahe hain jo Blogger ka standard format hai const response = await fetch('https://www.jkupdatenews.com/feeds/posts/default?alt=json&max-results=20'); if (!response.ok) throw new Error("Network response was not ok"); const data = await response.json(); const entries = data.feed.entry; if (!entries || entries.length === 0) { throw new Error("No recent posts found on the website."); } // 3. Setting Paper Header Date const today = new Date(); const dateOptions = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; paperDate.innerText = today.toLocaleDateString('en-IN', dateOptions); status.innerText = "Organizing 20 News Stories..."; container.innerHTML = ''; // Clear previous content // 4. Loop through entries and build Newspaper Layout let gridStarted = false; entries.forEach((entry, index) => { const title = entry.title.$t; // Content cleaning: HTML tags hata kar sirf text snippet lena let summary = ""; if (entry.summary) { summary = entry.summary.$t; } else if (entry.content) { summary = entry.content.$t.replace(/<\/?[^>]+(>|$)/g, "").substring(0, 350); } summary = summary.replace(/ /g, " "); // Image Extraction: Standard thumbnail ko High Resolution (s1600) mein badalna let imgUrl = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj_placeholder.png"; if (entry.media$thumbnail) { imgUrl = entry.media$thumbnail.url.replace('/s72-c/', '/s1600/').replace('/w72-h72-p-k-no-nu/', '/s1600/'); } if (index === 0) { // FRONT PAGE MAIN STORY (Big Image + Big Headline) container.innerHTML += `

${title}

${summary}...

Full report on website.
`; } else { // SECONDARY STORIES (Start Grid Layout) if (!gridStarted) { container.innerHTML += `
`; gridStarted = true; } document.getElementById('news-grid').innerHTML += `

${title}

${summary.substring(0, 180)}...

`; } }); if (gridStarted) container.innerHTML += `
`; // 5. PDF Generation Engine (html2pdf.js) status.innerHTML = 'Converting to PDF (This may take 10 seconds)...'; const filename = `JK-Update-News-${today.getDate()}-${today.getMonth()+1}-${today.getFullYear()}.pdf`; const opt = { margin: [10, 10, 10, 10], // Top, Left, Bottom, Right filename: filename, image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2, useCORS: true, letterRendering: true, logging: false }, jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }, pagebreak: { mode: ['avoid-all', 'css', 'legacy'] } }; // Execution await html2pdf().set(opt).from(renderArea).save(); // 6. Success State status.innerHTML = '✅ E-Paper Downloaded Successfully!'; btn.disabled = false; btn.style.opacity = "1"; btn.innerText = "📥 DOWNLOAD AGAIN"; } catch (error) { console.error("E-Paper Error:", error); status.innerHTML = '❌ Error: Could not generate PDF. Please refresh and try again.'; btn.disabled = false; btn.style.opacity = "1"; btn.innerText = "RETRY DOWNLOAD"; } } // ]]>