PDFPen Imprint Image

Hi there

Anyone had any experience applescripting PDFPen. It is certainly applescriptable but I am hitting a wall trying to do a small piece of automation.

Basically, I just want a script to add an image to the current page of the current document in the bottom left hand corner. So far, by playing with the scripts with the program, I have only been able to add the image across all pages of whatever document 1 is. Here is what works for adding the image to every page of document :


tell application “PDFpen”
tell document 1
set thePath to “/Users/andrewtetley/Desktop/Signature.pdf”

	set pageCount to count pages
	repeat with aPage in pages
		set imp to make new imprint with properties {path:thePath, x position:1, y position:1} at beginning of imprints of aPage
	end repeat
	
end tell

end tell


I can make it do just one selected page by doing this:


tell application “PDFpen”
tell document 1
set thePath to “/Users/andrewtetley/Desktop/Signature.pdf”

	set listofpages to pages
	
	set imp to make new imprint with properties {path:thePath, x position:1, y position:1} at beginning of imprints of (item 2 of listofpages)
	
end tell	

end tell


In the last script, item 2 of listofpages will imprint the image to page 2, for example. But the script cannot automatically imprint to the current page of the current document. In summary, I suppose, I cannot work out how to determine/reference the current page of the current document.

Anyone have any clues/pointers?

Cheers