Copy link to clipboard
Copied
Hello forum!
I need help (sorry for my English)
I need a script that makes several moves:
1. user chooses a folder
2. create PDF from JPG ( from full path )
3. save as MS Word ( with options: OCR false, Comments false )
4. close PDF without saving
I'm not a newbie but i never developed for Acrobat.
Please help me with my simple task.
Thanks!
function get_files(path){
var folder = Folder(path).getFiles()
for(var i = 0; i < folder.length; i++){
if(File(folder[i]).constructor.name == 'Folder'){get_files(folder[i])}
else{
var f = File(folder[i]).fsName
if(f.split('.').slice(-1)[0].toLowerCase() == 'jpg'){
files[f.split('\\').slice(-1)[0].split('.').slice(0,-1).join('.')] = f
}
}
}
}
var path = Folder.selectDialog('')
if(path != null){
var files = {}
get_files(path)
for(k in files){
// here k is filename without extension
// files[k] is fullpath
createPDF()
saveasMSWord()
closePDF()
}
}
Copy link to clipboard
Copied
Why want you use the detour over PDF?
Copy link to clipboard
Copied
To perform OCR, most likely...
Copy link to clipboard
Copied
Although I'm seeing now they want to specify OCR as false, so yeah, it is a bit strange...
Copy link to clipboard
Copied
If we can do it without creating a PDF, that's great
Copy link to clipboard
Copied
I think you should be able to do it with an Action in Acrobat Pro. You don't need any scripts, though.
Just create a new Action and add to it a command to run Text Recognition and then a Save As and change the export type to Word. Run it on your files and it will convert all non-PDFs files to PDF first, and then perform the other commands on them.
Copy link to clipboard
Copied
Yes it worked, but I have subfolders...
Copy link to clipboard
Copied
If you select the parent folder as the starting point of the Action it will process all sub-folders, too.
Copy link to clipboard
Copied
Yes, but files are saved in the selected folder.
Copy link to clipboard
Copied
The Action Wizard works this way.