Skip to main content

HPC Download in PDF

Install Playwright

npm init -y
npm install playwright

npx playwright install 

 

Extract only PDF links 

grep -oP 'https://samagam.kvs.gov.in/mis/hpc[^"]+' urls.txt

 

Read URLs from a text file (BEST for many links)

Create a file:

urls.txt

Script

const { chromium } = require('playwright');
const fs = require('fs');

(async () => {

const urls = fs.readFileSync('urls.txt','utf8')
.split('\n')
.filter(Boolean);

const browser = await chromium.launch();
const page = await browser.newPage();

let i = 1;

for (const url of urls) {
console.log("Saving:", url);

await page.goto(url, { waitUntil: 'networkidle' });
await page.emulateMedia({ media: 'screen' });

await page.pdf({
path: `${i}.pdf`,
format: 'A4',
printBackground: true
});

i++;
}

await browser.close();

})();

 

Example Output

1.pdf
2.pdf
3.pdf
4.pdf

 

  

Popular posts from this blog

Libreoffice Macro To Export Batch PDF

Here is the complete LibreOffice Basic macro code, incorporating all the requested features: Exports as PDF. Exports only the defined Print Area ( A1:I37 ). Uses the sheet "Report card t-1" . Names the PDF file based on the value in cell B7 . Loops through roll numbers 1 to 40. You need to copy and paste this entire code block into your LibreOffice Basic IDE module. Complete PDF Export Macro Basic Sub ExportAllReportsToPDF_FinalFix() ' --- CONFIGURATION --- Const START_ROLL As Integer = 1 Const END_ROLL As Integer = 40 ' 1. The name of the sheet that contains the report card Const SHEET_NAME As String = "Report card t-1" ' 2. The named range for the cell that holds the roll number (used for VLOOKUP) Const ROLL_CELL_NAME As String = "RollNoCell" ' 3. The EXACT cell range of your report card print area Const PRINT_AREA As String = "A1:I37" ' 4. Set you...

Convert PDF to Booklet Format in CLI

To convert a PDF into a print-ready booklet via the command line, there are several commonly used CLI tools including pdfbook2, mkbookpdf, and a popular pipeline using Ghostscript and psutils. These methods work well on Linux systems and are free to use for personal document preparation. pdfbook2 Method pdfbook2 is a dedicated CLI tool for booklet imposition. On Ubuntu, install with: sudo apt-get install texlive-extra-utils Use it by running:      pdfbook2 input.pdf -o booklet.pdf   This will generate a new PDF arranged for booklet printing.