# `export_fonts` Export fonts and a JSON manifest for external editing ## Usage > pdftl `` `export_fonts` `[...]` `` `[output` `]` ## Details The `export_fonts` operation extracts embedded and referenced font assets from the PDF, writes their binary programs (.ttf, .otf, .pfb) to a directory, and compiles their wrapping metrics (/Widths, /W, /Differences) and /ToUnicode mappings into a unified, structured JSON file. This unifies character code mappings and layout metrics into a single sidecar file: `font_{obj_id}_{gen_id}_{name}.json` This file contains character-by-character definitions of both layout metrics (width) and semantic mappings (unicode) using a unified hexadecimal indexing schema. It also carries a top-level `width_sync_mode` field (default `auto`) that controls how [`import_fonts`]() reconciles width edits back into the PDF — see [`import_fonts`]() help for the available modes. ### Arguments * ``: **(Required)** The directory where the extracted font files will be saved. * `[output ]`: The file path to save the JSON manifest. If omitted, the manifest is automatically saved as `manifest.json` inside the specified directory. Specify `output -` to print the manifest directly to standard output. * `[tounicode=]`: Which format to use for /ToUnicode mapping sidecars. - `json` (default): Write high-level unified character mapping JSON. - `ps`: Write raw CMap PostScript stream text. - `all`: Write both formats side-by-side. * `[page_range]`: Optional page ranges to limit the extraction. ## Examples > Extract all fonts to 'my_fonts/' and save the manifest to 'my_fonts/manifest.json'. ``` pdftl in.pdf export_fonts my_fonts ``` > Extract fonts from pages 1-5 into 'edited_assets/' and write manifest to 'manifest.json'. ``` pdftl in.pdf export_fonts 1-5 edited_assets tounicode=all output manifest.json ``` **Tags**: info, metadata, fonts, export *Source: pdftl.operations.export_import_fonts* *Read online: [https://pdftl.readthedocs.io/en/latest/operations/export_fonts.html](https://pdftl.readthedocs.io/en/latest/operations/export_fonts.html)* *Type: Operation*