Jump to content
Sign in to follow this  
lucasgpr

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.

Share this post


Link to post

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

Share this post


Link to post

It would be great to have the query term put into preview's searchbar by default.

 

It can be, but as I said, it's just a bit of a more complicated workflow.

Share this post


Link to post

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

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  
×
×
  • Create New...