• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Batch jpg to pdf to ms word

Participant ,
Mar 03, 2021 Mar 03, 2021

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()

	}
}

 

TOPICS
How to , JavaScript

Views

431

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

Why want you use the detour over PDF?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

To perform OCR, most likely...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

Although I'm seeing now they want to specify OCR as false, so yeah, it is a bit strange...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

If we can do it without creating a PDF, that's great

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2021 Mar 03, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

Yes it worked, but I have subfolders...

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2021 Mar 03, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

Yes, but files are saved in the selected folder.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

LATEST

The Action Wizard works this way.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines