Add PDF -> XLSX conversion support#29
Open
sergeyFlakon wants to merge 1 commit into
Open
Conversation
`mpx convert input.pdf output.xlsx` now works. xlsx is a supported
v3/pdf conversion output (extracts tabular content, one worksheet per
detected table). The PDF path downloads v3/pdf/{id}.xlsx directly, so
this only needs the new destination extension + dispatch case.
Scope: PDF sources only. Image and Markdown sources are intentionally
not wired up — those paths convert the OCR'd MMD via the /v1/export/*
endpoints, and there is no /v1/export/xlsx endpoint. Supporting them
would require backend work (a /v1/export/xlsx endpoint or rerouting
those paths through v3/converter) and is left as a follow-up.
Validated against the live API: POST /v3/pdf-file (file only) then
GET /v3/pdf/{id}.xlsx returns a valid .xlsx (HTTP 200), matching the
CLI's exact call pattern.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
PDF → XLSXconversion:mpx convert input.pdf output.xlsx.xlsxis a supportedv3/pdfconversion output — it extracts tabular content, producing one worksheet per detected table. The PDF path already downloadsv3/pdf/{id}.{ext}directly, so this only needed:.xlsxadded tovalidDestinationExtensions(lib/mpx.js)pdf → xlsxdispatch case (lib/mpx.js)PDFToXLSX()=ConvertPDF("xlsx", …)+ export (lib/convert.js)Scope: PDF sources only
Image and Markdown sources are intentionally not wired to xlsx. Both convert the OCR'd MMD through the
/v1/export/{fmt}endpoints, and there is no/v1/export/xlsxendpoint.image.png → out.xlsx/doc.mmd → out.xlsxtherefore fall through to the existing "Not implemented yet" message rather than failing on an invalid extension.Supporting image/MMD → xlsx would require backend work — either adding a
/v1/export/xlsxSnip endpoint, or rerouting the non-PDF paths throughv3/converter(which does support xlsx). Left as a follow-up.Testing
node --checkon both edited files.POST /v3/pdf-file(file only, noconversion_formats) →GET /v3/pdf/{id}.xlsxreturns HTTP 200, a valid.xlsx(Microsoft Excel 2007+, one worksheet per detected table). Confirms the download path the CLI relies on produces xlsx without any extra submit options. Temporary test app_key deleted after verification.Release note
Version not bumped — leaving the minor bump +
npm publishto your normal release flow. This is a feature add (suggest0.4.0 → 0.5.0).Attribution
Triggered by user request: documenting/enabling XLSX across Mathpix conversion surfaces (companion to monorepo docs PR #21361 and website PR #21374). mathpix.com/docs/snip/mpx-cli should advertise xlsx only after this ships.
🤖 Generated with Claude Code