Set preferred width when capturing PDFs

Thanks. As I was looking for a script that saves a PDF of the current view I was happy to notice that the script from this 14(!) year old post still does the trick (with some minor updates) Capture PDF document to current group

tell application id "DNtp"
	try
		if not (exists think window 1) or not (exists content record of think window 1) then error "No window/document is open."
		
		set theWindow to think window 1
		set theURL to URL of theWindow
		set theName to name of theWindow
		set thePDF to PDF of theWindow
		if exists current group then
			set theRecord to create record with {name:theName, type:picture, URL:theURL} in current group
		else
			set theRecord to create record with {name:theName, type:picture, URL:theURL}
		end if
		set data of theRecord to thePDF
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

1 Like