Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Remove embedded fonts from a pdf.

Terminal - Remove embedded fonts from a pdf.
gs -sDEVICE=pswrite -sOutputFile=- -q -dNOPAUSE With-Fonts.pdf -c quit | ps2pdf - > No-Fonts.pdf
2009-03-25 03:46:00
User: qubyte
Functions: gs
1
Remove embedded fonts from a pdf.

It's sometimes useful to strip the embedded fonts from a pdf, for importing into something like Inkscape. Be warned, this will increase the size of a pdf substantially.

I tried this with only gs writing with -sDEVICE=pdfwrite but it doesn't seem to work, so I just pipe postscript output to ps2pdf for the same effect.

Know a better way?

If you can do better, submit your command here.

What others think

On my ubuntu/debian system, there is a pdf2ps command (a script), which invokes gs in a similar manner. So you could possibly try this instead:

pdf2ps With-Fonts.pdf | ps2pdf - > No-Fonts.pdf

I'm somewhat of a novice at this stuff, but I think the "stripping" happens only because postscript *cannot* embed fonts. Usually I want to embed fonts for submission of papers in PDF.

Comment by bwoodacre 149 weeks and 2 days ago

I'm pretty sure postscript embeds fonts. If you look in a ps or eps file you can actually read bits, so like pdf the specification must include standard fonts.

I'm not entirely sure how mine works, although I do get the individual flags. I really just added the pipe. It's based on a one liner I saw a long time ago that spat out postscript from postscript.

Comment by qubyte 149 weeks and 2 days ago

I've looked through the manpage for gs 8.61 and can't see how the specified options are asking the postscript interpreter to discard font information. This just seems more like a side effect to me rather than deliberate program action.

Comment by bwoodacre 149 weeks and 2 days ago

Yup. That's pretty much the conclusion that I came to. It could be that you need to add a flag to preserve fonts and that's what's going on. Either way, it's worked for me for years and I've found it very useful.

I should note (and sorry this is confusing!) that when I say `remove embeded fonts' what I really mean is turn all the letters into normal vector graphics. This way the file is composed without any reference to text. The obvious side effects are that text in the pdf becomes unselectable and the file size goes up. I do this because Inkscape seems to fall over when it has to handle pdf fonts, and this fixes it.

Comment by qubyte 149 weeks and 2 days ago

I updated it to get rid of a couple of needless bits.

Comment by qubyte 149 weeks and 2 days ago

Your point of view

You must be signed in to comment.

Related sites and podcasts