I have PDF graphic in which I would like to have fonts removed. All other properties of the file should remain (such as size, etc). The output file should be in PDF as well. The text itself should be converted to outlines.

Can I do it at the moment of including the PDF figure in pdftex document? Or can I perhaps use a magic ghostscript command?

  • 4
    This looks like a duplicate of tex.stackexchange.com/questions/23407/… – Joseph Wright Sep 3 '11 at 8:03
  • Well, because this is a figure and not a page, the output after pdf2ps and then ps2pdf is a full-page document. The size has been lost... – ronszon Sep 3 '11 at 8:25
  • 3
    Do you mean that you have a lot of white space around the figure? So the final step can be to use pdfcrop (included in TeXLive, don't know in MikTeX). – Spike Sep 3 '11 at 8:53
  • Brilliant! That does what I wanted. I will update the question with an answer. – ronszon Sep 3 '11 at 10:02
  • 2
    Rather than answering your question within the question itself, you should add a separate answer. – lockstep Sep 3 '11 at 12:05

Following this answer, you should use the following command for the new (9.15+) ghostscript


gs -dNoOutputFonts -sDEVICE=pdfwrite -o vectorized_file.pdf file.pdf


gswin32 -dNoOutputFonts -sDEVICE=pdfwrite -o vectorized_file.pdf file.pdf

  • 1
    As of Feburary 7 2017, this was the only correct solution on this page (with a version of gs at least 9.15). – gui11aume Feb 7 '17 at 17:35

In my case (pdftops 0.18.4, GPL Ghostscript 9.05) the resulting PDF following the above answer still contained the fonts and the text was not converted to curves. However, the answer I found at this Malaysian LaTeX User Group site worked for me. This is the script I used:


if [ "x$1" = "x" -o "x$2" = "x" ]; then
    echo Usage: `basename "$0"` "<input.pdf>" "<output.pdf>" >&2
    exit 1

gs -sDEVICE=pswrite -dNOCACHE -sOutputFile=- -q -dbatch \
   -dNOPAUSE -dQUIET "$1" -c quit | ps2pdf - "$2"

Of course, a pdfcrop step can still be added if you need it.

If this gives you an error use -sDEVICE ps2write

  • Excellent! None of the answers in the linked questions worked. Your script does work. – Emit Taste Jun 25 '14 at 15:23
  • Thank you! If the OP is available, I would certainly nominate this post for being the appropriate and most effective answer. – eacousineau Oct 8 '14 at 21:11
  • 1
    Hmm... On Ubuntu 14.04 with gs 9.10, using -sDEVICE=ps2write with the final ps2pdf conversion does not seem to keep the text as paths. I will look for some solutions. – eacousineau Jan 13 '15 at 18:34
  • 3
    Looks like using pdf2svg with a SVG to PDF conversion tool (perhaps with Inkscape) does the job! From a Launchpad Bug Report. – eacousineau Jan 13 '15 at 18:44
  • 1
    @yo' It does work for me with gs 9.10. – Grodriguez Sep 7 '17 at 10:13

(Originally posted as part of question by OP ronszon)

The solution to the problem was conversion from PDF to PS, PS to PDF and cropping final PDF file.

pdftops myfile.pdf
ps2pdf myfile.ps
pdfcrop myfile.pdf
  • 4
    I don't know what you think that should do, but it does not convert the fonts to outlines (at least not with gs 9.05). – Martin Schröder Oct 4 '12 at 21:25

Another alternative is using pdf2svg, as indicated here: Launchpad Bug Report. In Ubuntu, you can install it as sudo apt-get install pdf2svg

My overarching goal in reading this post was to be able to edit the raw paths of the PDF in Inkscape, so this accomplishes my goal quite well.


As a succinct command, you can add the following command:

pdf-text-to-path() { name=${1%.[Pp][Dd][Ff]}; pdf2svg $1 $name.raw.svg; inkscape --export-pdf=$name.raw.pdf $name.raw.svg; }

The command pdf-text-to-path $name.pdf will generate $name.raw.svg and then use inkscape to convert the SVG to PDF in $name.raw.pdf. (Note: You will need Inkscape, which is admittedly bulky. convert seems to rasterize the image.)

  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. I don't see how this produces a PDF file? As well, it would be nice to make the answer self-contained, i.e., to show how exactly can pdf2svg be used to accomplish the goal of the question. – yo' Jan 13 '15 at 19:09
  • Thank you for the suggestions! I've made the corresponding adjustments. – eacousineau Jan 14 '15 at 16:31
  • Nice, thanks. Just: (1) Yes, convert is from ImageMagick which is a raster image processor. (2) inkscape knows to modify the dimensions of the PDF file if this is done, just so slightly, yet it can change the output significantly. – yo' Jan 14 '15 at 16:45

The -sDEVICE=pswrite output driver in Ghostscript has been deprecated since 12/15/2010. In Ghostscript versions >= 9.09, use ps2write or eps2write.

  • 1
    The question is 3 years old. You should tell that gs could have changed also options etc. Does it (I do not know)? BTW: Welcome to TeX.SE! – Mensch Dec 10 '14 at 17:48
  • 1
    This does not convert the fonts, it keeps them there! And FWIW, it has always been the case for gs9+. – yo' Apr 20 '15 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.