Skip to content
Reading documents 10 min read · LogicSpoke PDF

Reformat any resume into a polished PDF: a closed-loop pipeline example

TL;DR: Parsing a resume and generating a new one from a template are usually two separate integrations. LogicSpoke's extract-and-fill pipeline does both in one API call: parse the uploaded resume (schemaId: sys_resume), and the extracted fields flow straight into a target template — no glue code holding the two steps together. The same flow is also exposed as MCP tools, so an AI agent can do it from a plain-English request.

If you've ever tried to build a "reformat my resume" feature, you've probably hit one of two walls, and both are extensively documented in the wild:

The alternative that keeps showing up when people look for something more predictable is structured-data-in, template-out generation — RenderCV, a YAML-to-PDF resume generator with 17k+ GitHub stars, exists specifically because "no font issues, no layout breaking when you change one line" is a real, wanted property. That's the same model LogicSpoke's generation API uses — just with a Word template instead of YAML+LaTeX, and an extraction step in front of it so the "structured data" doesn't have to be typed by hand.

The problem with doing this as two separate API calls

The obvious approach: call the parse API to extract structured data from an uploaded resume, store the result somewhere, then separately call the generate API with that data to fill a new template. That's two integrations, two error paths, and your own code has to carry the extracted data between them.

LogicSpoke's closed-loop pipeline collapses this into one call — you give it the ID of an already-parsed source document and the ID of a target template, and it reads the extracted structured data straight out of the parse result and feeds it into generation. No serializing/deserializing extracted JSON yourself.

Step 1: parse the uploaded resume

curl -X POST "https://api.logicspoke.com/pdf/v1/pdf/parse/sync" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -F "[email protected]" \
     -F "schemaId=sys_resume"

sys_resume is one of LogicSpoke's built-in schemas — it extracts fullName, email, phone, location, currentTitle, totalExperienceYears, skills (array), workHistory (array of {company, title, from, to}), education (array of {institution, degree, year}), and languages (array). Whatever format the original resume was in — a dense two-column PDF, a scanned printout, a DOCX — you get the same shape back.

The response includes a parseId — that's what feeds the next step.

Step 2: upload your target template (once)

Design one modern resume template in Word using {{tokenName}} syntax, with a {{FOR job IN workHistory}}...{{END-FOR job}} loop for the work-history section:

curl -X POST "https://api.logicspoke.com/pdf/v1/pdf/templates" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{ "name": "Modern Resume Template", "docxBase64": "UEsDBBQABgAI..." }'

Do this once — the returned id is your targetTemplateId for every future reformat.

Step 3: run the pipeline

curl -X POST "https://api.logicspoke.com/pdf/v1/pdf/pipelines/extract-and-fill" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "sourceParseId": "parse_xyz789",
       "targetTemplateId": "tpl_abc123"
     }'

Response:

{
  "success": true,
  "jobId": "job_def456",
  "extractedData": {
    "fullName": "Jane Miller",
    "email": "[email protected]",
    "currentTitle": "Senior Software Engineer",
    "skills": ["JavaScript", "Python", "React", "PostgreSQL"],
    "workHistory": [{ "company": "TechCorp", "title": "Software Engineer", "from": "2018-03-01", "to": "present" }]
  },
  "status": "pending",
  "message": "Pipeline triggered: Data extracted and generation job queued."
}

Poll GET /v1/pdf/jobs/{jobId} for the finished PDF — the download link comes back as outputUrl. One orchestrated call — parse and generate never touch your own server in between.

Building it into a React app (Node SDK)

A minimal Express endpoint wrapping the whole flow:

// The Node SDK is coming soon; until it is out, the same calls go to the REST API.
import { LogicSpokePDF } from '@logicspoke-pdf/sdk';
import multer from 'multer';

const sdk = new LogicSpokePDF(process.env.LOGICSPOKE_API_KEY);
const upload = multer();

app.post('/api/reformat-resume', upload.single('resume'), async (req, res) => {
  // Step 1: parse the uploaded resume
  const parsed = await sdk.parse.sync(req.file.buffer, {
    fileName: req.file.originalname,
    schemaId: 'sys_resume'
  });

  // Step 2: run the pipeline against a pre-uploaded template
  const pipeline = await sdk.pipelines.extractAndFill({
    sourceParseId: parsed.parseId,
    targetTemplateId: process.env.RESUME_TEMPLATE_ID
  });

  // Step 3: poll until the generation job finishes
  const job = await sdk.generate.pollUntilDone(pipeline.jobId);
  res.json({ downloadUrl: job.outputUrl });
});

And the React side — an upload form that calls it and shows a download link:

function ResumeReformatter() {
  const [status, setStatus] = useState('idle');
  const [downloadUrl, setDownloadUrl] = useState(null);

  async function handleUpload(e) {
    const file = e.target.files[0];
    if (!file) return;

    setStatus('processing');
    const form = new FormData();
    form.append('resume', file);

    const res = await fetch('/api/reformat-resume', { method: 'POST', body: form });
    const { downloadUrl } = await res.json();
    setDownloadUrl(downloadUrl);
    setStatus('done');
  }

  return (
    <div>
      <input type="file" accept=".pdf,.docx" onChange={handleUpload} />
      {status === 'processing' && <p>Reformatting your resume…</p>}
      {status === 'done' && <a href={downloadUrl}>Download your new resume</a>}
    </div>
  );
}

No headless browser in your infrastructure, no client-side font loading, no page-break math — the layout logic lives entirely in the Word template, and LibreOffice handles the DOCX→PDF conversion server-side.

Doing the same thing through an AI agent (MCP)

LogicSpoke also exposes this as MCP tools, so an AI agent (Claude Desktop, or any MCP-compatible client) can run the same flow from a plain-English request instead of you writing the orchestration code. The two relevant tools:

  • logicspoke_parse — takes a fileUrl (not a raw upload — the agent needs a URL to the file) and an optional inline schema string
  • logicspoke_generate — takes a templateId and a data object of token values
  • logicspoke_get_job_status — polls either job type to completion

A user could ask their agent: "Here's a link to my old resume — extract my work history and generate it using my standard resume template." The agent calls logicspoke_parse with the file URL, waits on logicspoke_get_job_status, then calls logicspoke_generate with the extracted fields and your template ID — no code written by the user at all. Note the MCP tool surface is intentionally narrower than the REST API today: logicspoke_parse takes an inline schema, not a schemaId reference, so an agent-driven flow needs the schema pasted in rather than referenced by name.

Questions

Does the pipeline work with any template, or does it need to match the source schema exactly?

The pipeline just passes whatever fields the source parse extracted straight through as token values — if your template references a token the extraction didn't produce, it's left unfilled rather than erroring. Design your template's tokens to match the schema you parsed with (e.g. sys_resume's field names) for a clean fill.

What if the uploaded resume is a scan, not a text PDF?

The parse step automatically routes scanned documents through OCR — same pipeline call, no extra configuration.

Can I use a custom schema instead of sys_resume?

Yes — pass an inline schema (or your own saved custom schemaId) to the parse step instead, and the pipeline will carry through whatever fields that schema extracts.

Stop maintaining two separate integrations for one workflow.

Parse and generate in a single pipeline call.