I'm working on adding features to the attached document. The intent is for techs to be able to open the file, fill it out, and generate a report. One feature that would be very useful would be to delete a photo in the middle of the document (easy part) and have the photos below it each move up. This will mean moving the top photo/caption of one page up to the bottom of the previous page, moving the bottom one to the top, rinse, repeat (hard part). How can I best achieve this?
You can use the buttonSetIcon and buttonGetIcon methods to copy the image from one field to another.
You can't really reset a selected button's field directly, though. A workaround is to keep a (hidden) empty button field and copy its icon to the fields that you want to reset.
So if I used buttonSetIcon and buttonGetIcon--I figure I will want to store each icon/caption occuring past the one to be deleted in an array, then iterate buttonSetIcon through the array, changing all affected buttons. Does this sound like the right approach?
Another issue to consider is deleting pages in the PDF. I have a counter that numbers my unique fields. Normally they'll be numbered sequentially, similar to what spawn does with bRename = true. If a user deletes a page from the PDF, the sequence is off. My numbering will continue to count up, so I avoided that issue, but how will I check for this issue when iterating through all my buttons?
Yes, that sounds about right.
You will get into all kinds of issues if you delete pages and then spawn new ones. The numbering will be off, and you might get duplicate field names. It's a very tricky thing to set up correctly.