pdf-surgeon.yaml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. name: pdf-surgeon
  2. repo: https://github.com/Samuek9/pdf-surgeon
  3. sha: 0d3baf4f45bd00c2730e3f23e2d8981e5c916165
  4. description: >-
  5. Model-driven editor of PDF text whose result keeps the original typesetting, by rewriting the
  6. page content stream in place — the string operand inside the existing BT/ET block is replaced and
  7. the Tm origin of everything after it on the line is retargeted, so font, size, colour, baseline,
  8. char/word spacing, horizontal scale and kerning survive untouched because they are never
  9. rewritten. This is the alternative to redact-and-re-stamp, which defaults to Helvetica 8pt and
  10. makes you restate font, size and colour by hand; get any of that wrong and the page reads as
  11. forged. The phrase must match exactly (whitespace is ignored); a fuzzy match is refused rather
  12. than allowed to edit text the caller never named. Until an edit is accepted the output is
  13. written under a temporary name next to the destination and moved into place only after
  14. verification passes, so a failed check leaves nothing behind; the destination must end in .pdf,
  15. must not already exist, must not resolve to the input, and must have an existing parent
  16. directory, because the path arrives from the model. Verification enforces that the edited line
  17. reads exactly as the original with the phrase swapped and nothing else, that every other line
  18. on the page is unchanged, that block count, baseline, font, size and spacing hold, that the old
  19. phrase's occurrence count dropped by exactly one (allowing for copies inside the replacement),
  20. and that the page's font/size/colour set is unchanged; a pixel-diff band is reported for
  21. information and does not decide the outcome. Refuses, writing nothing, on scans, Type3/XObject
  22. text, pages with more than one content stream, and a replacement needing
  23. a glyph the embedded subset lacks — it never falls back to substituting a typeface. Widths are
  24. measured from the embedded font program, not the system font of the same name. action="inspect"
  25. lists each line with its baseline and BT/ET block count so a caller can tell whether a document
  26. is editable before choosing what to replace. Requires a digital-born PDF whose text is laid out
  27. as one block per word/run with an explicit Tm origin (Word, LibreOffice, Excel, Google Docs).
  28. Disclosure — this can alter documents such as certificates or invoices; use it only on documents
  29. you are entitled to change. The edit is not visible on the page and not recorded in the Info
  30. dictionary. It is detectable at file level: the PDF is re-saved by PyMuPDF as a single revision,
  31. so the file hash and the second trailer /ID change, any earlier incremental-save history is
  32. dropped and any digital signature no longer validates. Writes only a new .pdf that does not
  33. exist yet and never touches the input. No network, credentials or subprocesses. Depends on
  34. PyMuPDF (AGPL-3.0), which Hermes installs for this plugin. Output files inherit the 0600 mode
  35. of the temporary file they are moved from.
  36. maintainer: Samuek9
  37. tier: community
  38. category: tools
  39. docs_url: https://github.com/Samuek9/pdf-surgeon#readme
  40. version: "1.0.1"
  41. platforms: [linux, macos, windows]
  42. capabilities:
  43. provides_tools:
  44. - pdf_replace_text
  45. provides_hooks: []
  46. provides_middleware: []
  47. requires_env: []