Command Line Interface
swapfont
swapfont: A toolkit for replacing fonts in PDFs.
Use one of the subcommands below to interact with the tool.
Usage
swapfont [OPTIONS] COMMAND [ARGS]...
Options
- --debug
Enable debug logging.
glue
Generate a swapfont compatible JSON from a swapfont-inspector output, only including fonts that the user has provided mappings for.
Usage
swapfont glue [OPTIONS] INSPECTOR_JSON OUTPUT_JSON
Options
- --mapping <mapping>
JSON file with user mapping: {source_base_font: target_font_file}
Arguments
- INSPECTOR_JSON
Required argument
- OUTPUT_JSON
Required argument
inspect
Analyzes a PDF to identify unembedded fonts and generate a replacement configuration.
Usage
swapfont inspect [OPTIONS] INPUT_PDF
Options
- --debug
Enable DEBUG level logging for verbose output.
Arguments
- INPUT_PDF
Required argument
run
Execute a font replacement using a config file.
INPUT_PDF: Path to source PDF. CONFIG_JSON: Path to mapping configuration.
Usage
swapfont run [OPTIONS] INPUT_PDF CONFIG_JSON
Options
- -o, --output <output>
Output PDF path
Arguments
- INPUT_PDF
Required argument
- CONFIG_JSON
Required argument
wizard
Interactive wizard to replace fonts in a PDF.
Usage
swapfont wizard [OPTIONS] INPUT_PDF
Options
- -o, --output <output>
Output PDF file path
- --replace-font <replace_font>
Specify (FONT_NAME, TTF_PATH) for replacement
- --yes
Automatically say YES to replacing all fonts
- --no-interactive-replace
Automatically say NO to replacing fonts unless provided via –replace-font
- --no-replace-all
Automatically refuse all font rules, even CLI-specified
- --no-ligatures
Disable ligature detection and mapping entirely
- --accept-ligatures
Automatically accept ligature mappings without prompting
Arguments
- INPUT_PDF
Required argument