Tuesday, September 19, 2006

 

Drawing Maps

Sometimes, the darndest things happen. I know that Illustrator is probably a better choice for drawing maps, but I'm still intimidated by Illustrator and anyway, InDesign has all the drawing tools I need.

But I ran into two problems that needed a quick and dirty one-line script.

To give my map a frame, I needed to group the map and paste it inside a rectangle. Having done that, I couldn't persuade the Type on a Path tool to work. So:
myTP = app.selection[0].textPaths.add({contents:"Dummy Text"});
And bingo! Selecting the right path was easy and this script got the ball rolling so I could now use the UI to massage the text and prettify it!

But then I made the PDF and there were a whole bunch of elements that were visible when viewed in Mail and even in Acrobat 7 that shouldn't have been there. Somehow, I'd pasted more stuff into my map than I intended, and even though it was invisible in InDesign it was showing up in the PDF.

Well, I already have a script for seeking out instances of object styles in a document, so I was able to find one of these objects by deploying that script. But it quickly became boring deleting them one at a time when what I wanted to do was delete the lot.

For some reason, having selected one, clicking the Select Container button on the Control palette to get the group selected worked, but then hitting delete didn't.

So, another one-line script to the rescue:
app.selection[0].parent.pageItems.everyItem().remove();
I had to be a bit careful about deploying this one, but eventually, I got rid of all the clutter in my PDF (which reduced in size from 55K to 40K as a result of running this script, so I know it got rid of a bunch of invisible stuff.

This page is powered by Blogger. Isn't yours?