Editing a PDF on Linux: correcting the text or redrawing it in Inkscape

Opening a PDF and changing something seems like a single operation, but they are two different problems and require different tools.

Problem A — I need to change some text: an amount, a date, a name, an address. The layout is fine as it is.

Problem B — I need to redraw it: move elements, change colors, remove a logo, redo the layout. About the original text, I only care that it stays editable.

The first route requires a PDF editor. The second requires Inkscape, and to work on the text of a PDF in Inkscape you need one extra step: the fonts embedded in the document must become system fonts, otherwise Inkscape turns them into paths and the text is no longer text. Hence the extraction and renaming procedure that many people know.

This guide covers both routes, with commands that work on any distribution.

First of all: what kind of PDF do you have?

Three commands that save you from wasting an afternoon. They are all in poppler-utils (Debian, Ubuntu, Fedora, openSUSE) or in the poppler package on Arch.

pdfinfo documento.pdf      # pages, dimensions, version, program that produced it
pdffonts documento.pdf     # which fonts, whether embedded, whether subset
pdfimages -list documento.pdf   # whether there are scans inside

pdffonts is the most important one. It tells you three things that decide everything:

  • whether the PDF has fonts: an empty list means no text — either it’s a scan, or the texts have already been converted to paths;
  • whether they are embedded (emb column): if not, the PDF relies on fonts your system may not have;
  • whether they are subset (sub column, with names like ABCDEF+ArialMT): the document contains only the glyphs actually used, not the full alphabet.

Add pdftotext -layout documento.pdf - if you want to quickly see whether the text is extractable.

If the PDF is a scan, neither route works: you need OCR. If the text is in paths, there’s no font to extract: you can only edit it as a drawing, and route B applies without the font step.

Installing the tools

# Debian, Ubuntu, Mint
sudo apt install mupdf-tools poppler-utils fontforge inkscape

# Fedora
sudo dnf install mupdf poppler-utils fontforge inkscape

# Arch, CachyOS, Manjaro
sudo pacman -S mupdf poppler fontforge inkscape

# openSUSE
sudo zypper install mupdf poppler-tools fontforge inkscape

If you prefer sandboxed versions, Inkscape is available on Flathub. In that case remember that the Flatpak doesn’t see your per-user fonts folder until you grant it:

flatpak override --user --filesystem=~/.local/share/fonts org.inkscape.Inkscape

Route A — Correcting the text, without touching the fonts

Here you don’t need to extract anything. The PDF already contains everything: the text is stored with a reference to the embedded font, and a good editor modifies it in place.

Open PDF Studio is the free option I recommend to start with. LGPL-3.0 license, free, PDF engine written in Rust, available for Linux as .deb, AppImage, snap and in the AUR (open-pdf-studio-bin). It edits existing text in-place preserving font and formatting, fills forms, annotates, measures, compares two revisions and does OCR on scans. It also has a web version that works entirely in the browser, if you want to try without installing anything.

Two limits to know before trusting it:

  • subsets. If the embedded font contains only the used glyphs, typing new characters may not be possible and the program falls back to another font. This applies to any editor: it’s a property of the PDF, not a defect of the application. Try on a copy, on a word that contains new letters;
  • complex formatting. Multi-column text, tables, fields with particular kerning: in-place editing works, but it’s not layout. If you need to move blocks of text, you’re in route B.

Free alternatives: LibreOffice Draw opens PDFs and lets you edit the text, but it rewrites the entire content flow and often ruins the document — use it on simple PDFs and always on a copy. pdfarranger is for something else: reordering, rotating, merging and deleting pages, and it’s excellent at that.

Route B — Redrawing in Inkscape

Inkscape imports PDFs via Poppler. The text stays text only if the font is installed on the system; otherwise it is converted to paths or substituted. Hence the three steps.

1. Extract the fonts

mutool extract documento.pdf

It downloads the fonts and images of the PDF into the current folder, with generic names like font-0001.ttf or font-0002.cff. The alternative is pdftocairo, which converts the pages to SVG but tends to turn the text into paths: handy for a drawing, useless if you need editable text.

2. Rename in FontForge

An extracted font is named like its original, but it’s a fragment: if you install it as is, the system sees it as a duplicate or as the same font, and the PDF keeps using the embedded one. It must be renamed.

Open the file in FontForge, then Element → Font Info and work on two tabs:

  • PS Names — change the PostScript Name;
  • TTF Names — change Family Name, Preferred Family, Style and Full Name.

The field that matters most of all is the PostScript Name: if it stays the same as the original, fontconfig and the programs consider your font identical to the one they were trying to replace, and nothing visible happens. Choose a recognizable name, for example ArialMT-Estratto.

Then File → Generate Fonts, OpenType or TrueType format, and save. If mutool produced a .cff (Type1/CFF font), open it in FontForge and regenerate it as OTF: installing the raw .cff gives unreliable results.

3. Install and update the cache

Per-user installation works on any distribution and doesn’t require administrator permissions:

mkdir -p ~/.local/share/fonts/estratti
cp *.otf *.ttf ~/.local/share/fonts/estratti/
fc-cache -f
fc-list | grep -i estratto

If fc-list doesn’t show it, don’t install it manually in /usr/share/fonts: the problem is almost always the font’s internal name, not the folder.

Close and reopen Inkscape. The font list is read at startup: with Inkscape open you’ll never see the new font.

4. Import

Drag the PDF into Inkscape and in the import window choose to import the text as text, not as paths. If Inkscape doesn’t recognize the PDF’s font, use the option to replace the document’s fonts with the closest one among those installed and indicate your extracted one.

From here you work as on a normal SVG: separate objects, editable text, scalable vectors.

When it’s better not to extract anything

If the PDF uses a commercial font and you only need to redo the layout, often the fastest and cleanest route is to replace the font instead of appropriating it. Look for a free equivalent with

fc-match "Helvetica"     # what the system would use in its place

and consider families like Inter, Source Sans, Liberation, DejaVu, EB Garamond. You lose some metric detail, you gain a document you can publish without worries.

A warning worth keeping in mind: renaming a font is technically a modification, and almost all commercial font licenses prohibit modifications and redistribution. For personal work it’s a gray area that nobody checks; if the result goes to a client or to print, better not to do it.

Frequent problems

SymptomCauseRemedy
In Inkscape everything is pathsfont not installed or PDF without textextract and install, or check with pdffonts
The font doesn’t appear in the listcache not updatedfc-cache -f, restart Inkscape
The font appears but Inkscape doesn’t use itPostScript Name unchangedreopen FontForge and change that field
Characters replaced by squaresincomplete subsetuse a substitute font, or correct with the PDF editor
The text is unreadable when you select itCID font without Unicode mapnothing to do: import as paths and redraw
pdffonts shows Type 3glyphs defined as proceduresnot extractable: paths only
Inkscape hangs on large PDFstoo many vectorsmutool clean -gggg -z documento.pdf pulito.pdf, then import
You only need one pagehuge filepdfseparate documento.pdf pagina-%d.pdf

mutool clean -gggg -z is the first attempt to make on a heavy PDF: it deduplicates objects, compresses streams and often halves the file without touching the appearance.

In two lines

If you need to change some text: PDF editor, no extraction. If you need to redraw: pdffonts to understand what’s inside, mutool extract, rename in FontForge changing the PostScript Name, fc-cache, Inkscape reopened. If the PDF is a scan or has only paths, neither route applies and the starting point changes.

Leave a Reply