Skip to main content
Participant
March 25, 2022
Question

script to add a line to a placed pdf in illustrator

  • March 25, 2022
  • 3 replies
  • 741 views

Hello - I am still learning scripting.

 

I have a document that has small, placed pdfs and I want to be able to select the small pdf (it's about 1 x 2 inches, rectangle) and have a script add a leader line to the placed pdf. Imagine a comment box with a line and arrow head. Best if I could add lines to multiple placed pdfs at the same time. 

 

Even better, if I could customize the location of the line depending on where the placed pdf is located on the page. For instance, if I have a placed pdf on the left, I'd want the line to come out of the pdf on the right side, middle of the rectangle.

 

Is there any scripts out there that could do something like this? 

thanks in advance.

This topic has been closed for replies.

3 replies

Kurt Gold
Community Expert
Community Expert
March 26, 2022

You can download an improved style library that contains 20 different leader line styles including arrowheads.

 

Leader Line Arrow Styles 1

 

 

You can apply them to single linked files or simultaneously to multiple selected linked files.

 

You can also apply them to path objects, but you would first have to make sure that they are separate groups. That is, if you have for example 8 rectangles, each rectangle has to be a single grouped object. If you have multiple objects within one group the styles will be applied to the bounding box of the entire group.

 

As long as the styles are live they will adapt to the objects if you change their size. Also, you can tweak the style settings (e.g. position, angle or size of the leader lines).

 

m1b
Community Expert
Community Expert
March 27, 2022

Beautiful!

Kurt Gold
Community Expert
Community Expert
March 25, 2022

It's not a scripting approach. It's a graphic style way.

 

Leader Line Styles 1

 

Instruction:

 

- Download and unzip the file.

- Open a document that contains some linked .pdf files.

- In the Graphic Styles palette flyout menu, choose Open Graphic Styles library > Other Library and take the .ai file you have downloaded.

- Select one or all (ungrouped) linked .pdf files and apply one of the styles in the Style Library palette.

- Change the settings in the Appearance palette, if required.

 

Could certainly be improved, but you may check if this way could be useful.

 

Participant
March 25, 2022

Oh what an interesting way to do this! Thanks!

 

I'll test and report back ~ thanks kindly! 

Kurt Gold
Community Expert
Community Expert
March 25, 2022

Are the .pdf files embedded or are they linked files?

 

Participant
March 25, 2022

Great question! They are linked. It's prefered that they stay linked, but is there a difference in the script if they are not?