Checking an uploaded resume PDF before anyone reads it
If your job board, career-services portal or review queue accepts resume PDFs, about 30 lines of Node.js can flag files with little extractable text, or with nothing that looks like an email address or phone number. Pars
If your job board, career-services portal or review queue accepts resume PDFs, about 30 lines of Node.js can flag files with little extractable text, or with nothing that looks like an email address or phone number. Parsers work from the text they can pull out of the file, and that text can be missing things the page shows.
The failure that convinced me to check for this comes from a ReadableResume parsing test where a sample resume had its name and contact details in a Google Docs text box. Google Docs exported the box as a picture. The page looked complete, but the PDF's text had no name, email or phone, and the open-source parser in the test took the first heading, "EDUCATION", as the person's name. It got 34 of 46 fields right.
The check
This uses pdf.js in Node to pull the text out the way a parser would start, then runs three checks: fewer than 200 non-whitespace characters, no email match and no phone match.
// check-resume.mjs — usage: node check-resume.mjs resume.pdf
import { readFile } from "node:fs/promises";
import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs";
const EMAIL = /[\w.+-]+@[\w-]+(\.[\w-]+)+/;
const PHONE = /\+?\d[\d\s().-]{7,}\d/;
async function checkResume(path) {
const data = new Uint8Array(await readFile(path));
const pdf = await getDocument({ data }).promise;
const pages = [];
for (let number = 1; number <= pdf.numPages; number++) {
const page = await pdf.getPage(number);
const content = await page.getTextContent();
// Rebuild lines from text items; hasEOL marks the end of a line in pdf.js
let text = "";
for (const item of content.items) text += item.str + (item.hasEOL ? "\n" : "");
pages.push(text);
}
const text = pages.join("\n");
const firstLine = text.split("\n").map((line) => line.trim()).find(Boolean) ?? "";
const problems = [];
if (text.replace(/\s/g, "").length < 200) problems.push("fewer than 200 non-whitespace characters: possibly a scan or an image saved as PDF");
if (!EMAIL.test(text)) problems.push("no text matched the email pattern");
if (!PHONE.test(text)) problems.push("no text matched the phone pattern");
return { pages: pdf.numPages, characters: text.length, firstLine, problems };
}
console.log(await checkResume(process.argv[2]));
I ran it on a one-page sample resume exported from Google Docs, then on the same file after turning it into an image-only PDF with ImageMagick (magick -density 150 sample.pdf scanned.pdf), which is roughly what a scan or a "print to image" gives you:
$ node check-resume.mjs sample.pdf
{ pages: 1, characters: 1494, firstLine: 'Grace Liu', problems: [] }
$ node check-resume.mjs scanned.pdf
{
pages: 1,
characters: 0,
firstLine: '',
problems: [
'fewer than 200 non-whitespace characters: possibly a scan or an image saved as PDF',
'no text matched the email pattern',
'no text matched the phone pattern'
]
}
Both files look the same on screen. The script pulled 1,494 characters from the original and none from the image-only copy.
What to do with the result
- No text at all. Ask for a fresh export from the original document instead of rejecting the upload outright. A scan or an image saved as PDF has no text until something runs OCR on it.
- No email or phone match. Paste the PDF's text into a plain editor and look for the contact details. If they're missing there but visible on the page, in a text box or an image, ask the person to move them into the body of the document and export again.
- Show the first line the script extracted. "Your PDF's text starts with 'EDUCATION'" lets the uploader compare it with the page and see whether their name made it into the text.
What this doesn't catch
A PDF can pass all three checks and still read badly. The script can't tell whether the words come out in the right order, whether a two-column layout mixed lines together, or whether a job's dates wrapped onto a second line in a narrow table column. That last one cost 6 fields in the same test: the parser read the year on the second line as the company. To check by hand, paste the text into a plain editor and read it top to bottom, checking that each job's dates still sit with the right entry; this guide on what to look for in the pasted text goes through the other cases. A free ATS resume checker shows what the same open-source parser put in each field and every line of text it read from the first three pages of a PDF; the file stays in your browser.
The phone pattern is loose on purpose so it accepts numbers with country codes, and it's too loose in one way: it also matches a date range like 2023 - 2024, so this check can miss a missing phone number. The parser in that test only recognised US-style numbers.
A form for review requests
If you review resumes by hand, ask people to upload the PDF or Word file they plan to submit. A resume review request template on Tally collects that file along with the role they're applying for, their career stage and when they need feedback. The job posting link is optional.
I work on ReadableResume, which ran the parsing test and makes the checker mentioned above.
I used AI to help draft this post.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.