Repository navigation
v8.6.0
v8.6.0: 🧩 Template Checks, Form Fields & pdf.js Side by Side
I am pleased to announce the release of officeParser v8.6.0! Templates can list their tags and check data before a render, form fields in Word and OpenDocument files are read instead of dropped, sections that restart their page numbers keep them, and PDF parsing works beside an application's own pdf.js of another version.
Thanks to @setthase, whose report drove the pdf.js fix in this release.
🌟 Key Highlights
1. Listing tags and checking data
OfficeTemplate.tags() lists a template's fields and block tags, with their parts, paths, filters and loops, with no data needed. OfficeTemplate.check() reads your data against the template without rendering and returns every problem a render with onMissing: 'error' would reject for, all at once, each with its part and loop pass:
const problems = await OfficeTemplate.check('invoice.docx', { data });
// [{ code: 'TEMPLATE_FIELD_MISSING', field: 'line.qty', loops: [{ list: 'lines', index: 1 }], ... }]2. pdf.js of another version in the same process (#128)
parseOffice rejected every PDF ("The API version ... does not match the Worker version") when an application's own pdfjs-dist of another version had loaded first. officeParser now runs pdf.js's worker on a module of its own, in either load order. pdfjs-dist stays pinned to the version officeParser is tested with; the README explains why.
3. Form fields in DOCX, ODT and ODP
Word's legacy check boxes read as ☒ or ☐ and its drop-downs as the selected entry. OpenDocument check boxes, radio buttons, text fields, list and combo boxes read as they show. All were dropped before. The native PDF engine draws ☐ ☑ ☒ as boxes when no font has them, instead of ?.
4. Page numbers that restart
A Word, RTF or ODT section that restarts its page numbers (a body at 1 after front matter) is read into PageSetup.pageNumberStart and numbered so in DOCX, ODT, RTF, LaTeX and the native PDF engine.
5. Sheet tabs without JavaScript
A workbook's HTML switches sheets by CSS where its script does not run: scripts off, a sandboxed frame, or a fragment inserted into a page.
🔧 Also Fixed
- A pdf.js document your own code opens no longer moves PDF parses out of the separate process.
- pdf.js documents your own code opens no longer print warnings after an in-process parse.
- A preloaded pdf.js worker parses in the browser under
allowRemoteAssets: false. PDF_NO_TEXT_EXTRACTEDsays how much text was read and names fonts with no character map.- HTML workbooks show one sheet at a time in frames that block storage.
📝 On the blog: Two Versions of pdf.js in One Process and Form Fields That Were Never Text.
🛠 Getting Started
npm install officeparser@8.6.0🔗 Full Changelog: View v8.6.0 details
🔗 Documentation & Visualizer: officeparser.harshankur.com