Jump to content

Search in pdf files


Recommended Posts

Hi, it`s possible search in pdf file with some words? 

Example: search "enable all options" in tutorial.pdf, Alfred show me one part of the pdf, after click directs me the search term?

Thanks.

 

Alfred can indeed search within the contents of a PDF document but it wouldn't open the document to the location that the search term was found in the document, it would only open the document. This COULD be done would be rather tricky and would take a bit of a custom workflow to achieve it. You would have to create a workflow to save the search text, then using a script filter search for matching files manually. After a file is selected, using the remaining portion of the workflow to open it, and then search (using Preview?). The search could be done using AppleScript like this:

tell application "Preview"
	activate
	tell application "System Events"
		tell process "Preview"
			click menu item "Find…" of menu "Find" of menu item "Find" of menu "Edit" of menu bar item "Edit" of menu bar 1
			keystroke "{query}"
		end tell
	end tell
end tell

Where {query} would be replaced by the search text

Link to comment

Alfred can indeed search within the contents of a PDF document but it wouldn't open the document to the location that the search term was found in the document, it would only open the document. This COULD be done would be rather tricky and would take a bit of a custom workflow to achieve it. You would have to create a workflow to save the search text, then using a script filter search for matching files manually. After a file is selected, using the remaining portion of the workflow to open it, and then search (using Preview?). The search could be done using AppleScript like this:

tell application "Preview"
	activate
	tell application "System Events"
		tell process "Preview"
			click menu item "Find…" of menu "Find" of menu item "Find" of menu "Edit" of menu bar item "Edit" of menu bar 1
			keystroke "{query}"
		end tell
	end tell
end tell

Where {query} would be replaced by the search text

 

David,

Please help me implement this script, how to create a workflow to save search text? 

I am using "in" to find inside the pdf,  would like to click in archive to execute your script and show me what was sought.

Thanks.

Edited by lucasgpr
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...