I’ve done some searching on this but haven’t seen anything recent when searching “convert pdf date”. I’m trying to convert pdf images to PDF+Text while preserving all the originals attributes including all date information (created, modified, added) and replicant locations. Is there a script/automator workflow for this? Thanks!
It is possible to convert and retain the replicants, labels, comments, but not the dates. Date-synchronization between the unconverted- and converted-PDF files is possible with a script.
Has anyone figured out how to script this? I’ve tried modifying some date manipulation scripts (which I think were provided with Devonthink) but the variable this_date doesn’t seem to persist from one script to another. (Don’t see how to do this in one script since the date needs to be read from one item but applied to another item. The scripts only seem to work on a single item.)
I have to correct myself - addition date is get-only. It cannot be set.
This script will get the creation date and modification date from the non-OCRd PDF (kind == “PDF”) and change the corresponding date values in the OCRd PDF (kind == "PDF+Text). Tests are performed to ensure (1) there are only two documents selected, (2) both are PDFs, (3) only one is a non-OCRd PDF. There is no explicit test for (3), but the other tests yield that outcome.
Warning: this is experimental. The script will change your data. It has not been tested on your data. It could destroy your data. The script does not check whether the two documents are duplicates of one-another, I assume you’d know that without needing automation to tell you
-- Warning: this script will change your data. It has not been tested on your data. It can destroy your data. -- v 0.1 -- Jun 1, 2012 @ 06:35 AM -- Selection must be a pair of PDFs, one of these must be kind == "PDF" -- Script sets the create and mod dates of the "PDF+Text" document to the dates of the "PDF" document tell application id "com.devon-technologies.thinkpro2" set theSelection to selection set selectionSize to count theSelection if selectionSize is not 2 then error "This script only works on two items" set noOCR to no set noPDF to yes repeat with thisItem in theSelection if kind of thisItem is "PDF" then set noPDF to no if kind of thisItem is "PDF+Text" then set noPDF to no if kind of thisItem is "PDF" then set createPDF to creation date of thisItem set modPDF to modification date of thisItem set noOCR to yes end if end repeat if noPDF is yes then error "Both documents must be a PDF" if noOCR is no then error "Neither document is an non-OCRd PDF" repeat with thisItem in theSelection if kind of thisItem is "PDF+Text" then set creation date of thisItem to createPDF set modification date of thisItem to modPDF end if end repeat end tell
Wow. Thanks. You hammered this out a couple of days ago? Well done. I worked on this problem for a while and eventually got frustrated. Admittedly, I’m not a scripter. (Reason number 384 why I’m not a programmer!) Thanks again.