How to add padding to a text?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
suman114
Posts: 13
Joined: 2016-04-17T23:51:39-07:00
Authentication code: 1151

How to add padding to a text?

Post by suman114 »

I want to add padding to a text in a pdf. Is there any way?

Code: Select all

convert file.pdf '-fill rgba(0,0,0,0.80) -undercolor #ffffff50 '-pointsize 10 '-weight bold '-draw "gravity southwest scale 1,0.8 fill black text 0,0 "My funny text" destination.pdf
I am literally stuck at it now
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to add padding to a text?

Post by fmw42 »

Use label: to create a text image with your undercolor as background. Then trim it and pad with your undercolor. Then composite it over your background pdf where you want it.

See
http://www.imagemagick.org/Usage/text/
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/crop/#trim
http://www.imagemagick.org/Usage/crop/#border
Post Reply