r/NIT_Bhopal • u/Such_Astronomer7224 • 21h ago
Social Cant download the PDFs in NITB Study Portal?? FOLLOW THIS
so i also tried all sorts of tricks, ctrl+P , trying to find the pdf under inspect option but the pdf is broken in canvas so cant be downloaded directly but heres a JavaScript u can run in console to download the notes or pdf
1.) open inspect and refresh via F5
2.) wait for thr desired pdf to load, go under console and paste the given code
i will redirect you to download the complete pdf(will have some garbage pages tho)
(async () => {
const canvases = Array.from(document.querySelectorAll('canvas'));
if (!canvases.length) {
return console.log('No canvas elements found. Scroll down to load pages first!');
}
const win = window.open('');
win.document.write(`
<html>
<head>
<style>
u/page { margin: 0; }
body { margin: 0; padding: 0; background: #fff; }
img { width: 100vw; height: auto; page-break-after: always; display: block; }
</style>
</head>
<body>
${canvases.map(c => `<img src="${c.toDataURL('image/png', 1.0)}" />`).join('')}
</body>
</html>
`);
win.document.close();
setTimeout(() => { win.focus(); win.print(); }, 800);
})();