1

currently, I'm trying to write a program (in C), which would allow me to search/replace text of pdfs. I already can search for the string and edit the string itself, but somehow I cannot find a way to really edit the object of the document.

Does someone know, how to "send" the changes back to the document in the library of mutool/mupdf?

atticus
  • 138
  • 15

1 Answers1

1

If you consider using Command Line Tools you can use Mutool clean.

mutool-clean

Using this tool you can rewrite content streams.

"The clean command pretty prints and rewrites the syntax of a PDF file. It can be used to repair broken files, expand compressed streams, filter out a range of pages, etc."

InUser
  • 1,138
  • 15
  • 22
  • Yes decompressing the pdf, then use a tool like `sed` and compressing it again is possible, but I hoped to do this without the need of doing the whole procedure (in addition one has to check that sed only replaces strings in the content streams and not of the pdf structure, but this should be possible somehow) – atticus Sep 03 '20 at 14:06