Adobe Illustrator: Fitting Artboard to Object

When working with Adobe Illustrator, many times you’ll find that the objects that you want to save as a JPG or SVG are on an artboard that is larger than the size of the object. If you save the artwork, the object including the whitespace around it up to the borders of the artboard is saved. This is usually not what you want. If you want to save just the object, you need to resize the artboard to fit the borders of the object.

Below, you’ll see the artboard is bigger than the object (I clicked on View > Outline to show an outline of the object).

illustrator-artboard-crop-1

Click the artboard tool (Shift-O) and position your mouse cursor over the object and then double-click.

illustrator-artboard-crop-2

This will crop the artboard to fit the size of the object.

illustrator-artboard-crop-3

UPDATE: Actually, there’s an easier way. Just select the artwork then choose Object > Artboards > Fit to Artwork Bounds.

Fix Patch Error – patch unexpectedly ends in middle of line

I was patching a file with a patch file containing all adds (+). If should have been straightforward but I got the following error.

bash-3.2$ patch –unified –batch –ignore-whitespace -p0 -V never -r /dev/null < /4109.patch
patching file /index.html
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 127:

bash-3.2$

There’s an empty line  after the colon which is suspicious. I opened the patch file and added a line break at the end of the file, reran the patch command and it worked.

If this happens to you, try adding a line break at the end of your patch file. Stupid, as hell, I know, but it worked 🙂