第二個功能長在 File Diff 模式裡。以前 Lode 的 File Compare 是給文字檔/程式碼用的 side-by-side diff;現在你可以直接丟兩份 PDF 進去,上方會出現 「PDF text diff (extracted)」 標籤和 Text / Visual 切換。
在 File Diff 裡把兩份多益講義 PDF 抽成文字比對——左紅右綠逐行差異,保留 ## Page 頁碼標記,還能搜尋與複製。Two TOEIC study-note PDFs diffed by extracted text in File Diff — red on the left, green on the right, with ## Page markers preserved, and the text stays searchable and copyable.
Text 模式:Lode 用 macOS 內建的 PDFKit 把每份 PDF 的內嵌文字層抽成純文字,再丟進跟比程式碼同一套的 Monaco diff ——左邊紅色是被刪掉/不同的,右邊綠色是新增的。抽出來的文字會保留 ## Page 1 這種頁面分隔標記(由 PDFKit 逐頁走出來的),讓你知道差異落在第幾頁。因為走的是文字層、不是 OCR,所以純掃描的圖片型 PDF 抽不到字——這是個要知道的限制。
為什麼預設是「抽文字」而不是「比圖」?因為多數時候你想知道的是內容改了什麼,不是像素差幾格。合約改了哪一句、報價單改了哪個數字、講義換了哪個例句——這些都是文字層級的問題,抽成文字後不但看得清楚,還能複製、搜尋。上圖那個例子就是很真實的用途:把兩份多益講義 PDF 丟進去,一眼看出「詞類題」那份和「非白領情境核心短語」那份在內容上差在哪。
搭配既有的 「Review clipboard…」,你也可以複製一段文字,直接跟一份 PDF 抽出來的內容比對,不用先另存檔案。(同一條管線也吃 Word:.doc/.docx 會轉出文字與 PDF,甚至能 docx 對 pdf 混比。)
Lode dev notes: built-in screenshot markup + PDF content compare
Two features shipped in Lode this week. They look unrelated, but they come from the same motivation: not wanting to leave the file workbench I already have open for one small task.
One is an Annotate mode inside the Viewer — open a PNG and add arrows, highlight boxes, redact sensitive info, crop, resize, and save. The other is PDF content compare — extract text from two PDFs and diff it side-by-side, so you can see exactly what changed in the words between two versions.
Both came out of dogfooding. I spend all day in Lode viewing files, comparing things, and prepping App Store assets — but marking up a screenshot meant jumping to Preview or Skitch, and comparing two study-note PDFs meant converting each to text first. Lode is the window I keep open longest, so both jobs moved in.
Feature 1: screenshot markup inside the Viewer
Lode could already view images. This adds a pencil button to the image view that flips “view” into “edit,” dropping you onto an annotation canvas (the annotate/ bundle is lazy-loaded, so it never weighs down startup).
What it does
Annotate: arrows, rectangles, ellipses, lines, highlighter, auto-numbered steps (①②③), freehand brush, and text — make “look here” obvious.
Redact: use the clone stamp (Alt-click sets the source), blur, or pixelate to cover emails, serials, and paths. This is the tool I reach for most before publishing anything.
Brush feel: Fine / Normal / Rough strokes (6 / 24 / 70 px) plus a size slider and a row of common swatches.
Crop, resize, rotate: crop off noisy edges; resize to a target size (store screenshots often need exact pixels); rotate 90°.
Layers & objects: vector annotations are discrete objects — select, duplicate, delete, reorder — with a layers panel; Undo/Redo works at the object level.
Save: PNG / JPG only, and never cross-format (png in → png out). Defaults to “Save a Copy”; overwriting the original asks first.
Under the hood it’s a hybrid renderer: vector annotations are SVG, retouch (clone/heal) paints onto a raster canvas underneath, and text edits use a real <textarea> overlay — the three layers only get flattened into one bitmap on save. The point is the flow: screenshot → open in Lode → annotate/redact → save, without leaving the app.
Feature 2: PDF content compare (text-extracted diff)
The second feature lives in File Diff mode. Lode’s File Compare used to be a side-by-side diff for text and code; now you can drop two PDFs straight in, and a “PDF text diff (extracted)” label appears with a Text / Visual toggle.
在 File Diff 裡把兩份多益講義 PDF 抽成文字比對——左紅右綠逐行差異,保留 ## Page 頁碼標記,還能搜尋與複製。Two TOEIC study-note PDFs diffed by extracted text in File Diff — red on the left, green on the right, with ## Page markers preserved, and the text stays searchable and copyable.
Text mode: Lode uses macOS’s built-in PDFKit to pull the embedded text layer out of each PDF as plain text, then feeds it into the same Monaco diff used for code — red on the left for removed/changed, green on the right for added. The extracted text keeps ## Page 1 page markers (walked out page-by-page by PDFKit) so you know which page a change lands on. Because it reads the text layer and not OCR, a purely scanned/image PDF has no text to extract — a limitation worth knowing.
Visual mode: renders each page to an image, side by side, to compare layout; there’s also a Diff overlay that blends two pages with a difference composite so a shifted layout jumps out. That render path only starts the first time you open Visual.
Why extract text instead of comparing images? Because most of the time you want to know what content changed, not how many pixels differ. Which clause moved, which number in a quote changed, which example sentence a handout swapped — those are text-level questions. Extracting to text makes them clear, and lets you copy and search the result. The example above is a real use: drop two TOEIC study-note PDFs in and immediately see how the “parts of speech” set differs from the “non-white-collar core phrases” set in actual content.
Combined with the existing “Review clipboard…”, you can copy a snippet and diff it against a PDF’s extracted text without saving a file first. (The same pipeline handles Word too: .doc/.docx get text + a rendered PDF, and you can even diff a docx against a pdf.)
Two small dev-note trade-offs
Markup is two layers: vectors stay editable, retouch is baked. Arrows, text, and boxes are SVG objects, so you can reselect, move, and cleanly undo them — but clone stamp, blur, and pixelate are inherently pixel operations, painted onto the raster canvas beneath. One easy-to-miss detail: blur is rendered with padding, because otherwise the selection’s edge would leak the original sharp pixels underneath — for a redaction tool that’s a giveaway. The magic wand also caches a full-image RGBA buffer, or every click would re-rasterize hundreds of MB.
PDF compare stands on macOS PDFKit and defaults to text. There’s no bundled third-party PDF engine — extracting text, counting pages, and rendering pages all call the system’s PDFKit (which is why it’s macOS-only, and also why it’s sandbox-clean and App Store-shippable). And “compare PDFs” defaults to extracted text rather than pixel-diffing two rendered pages, because the latter is nearly useless for “what content changed”: a different font or one kerning tweak paints everything red. Extract text, keep page numbers, run a Monaco diff — that maps to the real question. Switch to Visual when you genuinely need layout. Defaulting to the most common need was the plan from the start.
Both features share one spirit: cut the number of times you jump out for one small thing. Lode has always aimed to be a native, buy-once macOS file workbench — view, compare, search, Git — and now “mark up a screenshot on the way past” and “compare a PDF on the way past” too.