I use inDesign to create cue books for synchronizing supertitles with musical performances. My task is to place a snippet (2 text boxes and 2 vertical lines) onto a page of musical score like this:
At the moment, I open the snippet and click to place it on the image. Then I have to move it into precise position, then select the bottoms of the lines and adjust them to the bottom of the staff. I paste or type in the text, then select the end of the text box to size it to fit.
I would like to create a script that can analyze the placed .pdf image to determine where the top and bottom lines of the staff are, to place the snippet and size the lines appropriately.
My question is how to get the pixel data from the .pdf on the page. Is that even possible? My ideal work flow would be this:
I have been doing this process manually dozens of times for a short song, up to a thousand times or more for a major opera, so any automation would be a big improvement. I believe I can handle the logic and coding if I can learn how to access the .pdf pixel data.
interessting idea, I don't know if this analyzing is possible (I don't think so).
But are the notes always in the same position?
I would assume so, then you can place your snippet with Option/Alt + Click and it will restore it at the same position at which it was originally created. You can change that to the default behaviour in the preference (File handling -> Snippet import)
If you have multiple, e.g. four "lines" of notes on one page you could save your snippet with the maximum amount per page and delete if necessary.
And this workflow you can probably script, so that your script places the snippet on every page at the original position and then your only manual step would be to delete where you have fewer "lines".
Edit>Preferences navigate to File Handling
Could you provide one of the pdfs?
I've attached a short example of the kind of .pdf I work with. Each .pdf page is placed (linked) on a document page in InDesign. It may or may not (often not) be placed at 100%, but I can deal with that if there is a way to get to the pixel values.
Thanks to those suggesting ways to simplify without the pixel analysis, but I believe I've already optimized that as much as possible:
There are additional steps needed if the text field goes off the side of the page, or if two cues are too close together, but that's irrelevant to this.
I've done this enough thousands of times that it's a pretty smooth flow, but obviously getting a script to do any significant part of it would help immensely. I would enjoy the challenge of coding it, but have nowhere to start unless there is a way to access the .pdf image pixels. Maybe accessing screen pixels would be adequate, but probably not because one score can span the whole page, top to bottom, outside what is visible on screen.