Repository navigation
feat(documents): make PDFs with anytopdf, here or on a conversion node - #210
Merged
Merged
Conversation
Settings › Documents › Make PDFs with anytopdf (documents.converter): auto uses anytopdf only where LibreOffice and Chromium can't convert, anytopdf uses it for every document and image (and fetches release 0.3.0, checked against its checksum), lens never. A conversion node (documents.anytopdf_url + token, `anytopdf queue serve`) converts Office files too, so a small server needs neither LibreOffice nor Chromium. Run here it is offline, with no plugins or config file; the rendition records `anytopdf`. An image anytopdf fails on is read by Lens as before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HysPx1nJnWBK2JJKbmbqdZ
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HysPx1nJnWBK2JJKbmbqdZ
adeelahmad
marked this pull request as ready for review
October 6, 2026 18:41
6 of 8 tasks
21 of 23 tasks
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.
Requested by Adeel · project thread
Description
Before: on a server without LibreOffice and Chromium (the lean image, a Raspberry Pi), Office files, emails, web pages and text couldn't be made into documents. Images were read only by Lens's own OCR.
After: Settings › Documents › Make PDFs with anytopdf (
documents.converter):auto(the default) uses anytopdf only where Lens's own converters can't, and only when anytopdf is available. Nothing changes until then.anytopdf(For every document and image) makes Lens download anytopdf v0.3.0 for this machine, checked against the release's checksum, keeping only the program. It also reads images: a photographed page is found and flattened before OCR.lensnever uses it.A conversion node (
documents.anytopdf_urlplusdocuments.anytopdf_token) is another machine runninganytopdf queue serve. Every conversion goes there as a job, Office files included.How:
anytopdf.pyruns the program locally or talks to the node's/v1/jobsAPI.convert.to_pdfpicks it per file, and for text, web pages and emails it hands anytopdf the same cleaned HTML page Lens would print with Chromium. Run locally, anytopdf has no network, no plugins and no config file of its own. Its PDF has no provenance page, entities, colours or places, sodocuments.read_pdfreads only what the document says. The rendition recordsby: anytopdf. If anytopdf fails on an image, Lens reads the image itself as before.Motivation and Context
Phase 1 of the anytopdf integration plan. Before this PR, the v0.3.0 release was tested against Lens's own converters on the same files (report):
Face recognition and object detection stay Lens's own steps. In 0.3.0, face-id matched every face to one person, and the objects plugin only works with AGPL Ultralytics models.
Follow-ups, not in this PR:
Types of changes
!in the title)Checklist:
tests/api/test_anytopdf.pyuses a fake anytopdf and a fake node. Its last test runs the real v0.3.0 binary whenLENS_TEST_ANYTOPDFpoints at it, and it passed locally.docs/accordingly (docs/configuration.md#anytopdf).## UnreleasedinCHANGELOG.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01HysPx1nJnWBK2JJKbmbqdZ
Generated by Claude Code