Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
3  
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

4 Answers 4

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:

#!/bin/sh

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

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

share|improve this answer
    
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
    
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 at 18:34
    
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 at 18:44

(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
share|improve this answer
1  
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

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

share|improve this answer
    
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! –  Kurt Dec 10 '14 at 17:48

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.

EDIT:

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.)

share|improve this answer
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 at 19:09
    
Thank you for the suggestions! I've made the corresponding adjustments. –  eacousineau Jan 14 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 at 16:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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