Convert image to PDF + OCR from command line

Discussion for the End User use of OCR in PDF-XChange Editor and Viewer

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

margian
User
Posts: 22
Joined: Thu Feb 20, 2025 3:13 am

Convert image to PDF + OCR from command line

Post by margian »

Hello, there.
I need to take and archive long screenshots from webpages in .png or .jpg (or other image) formats, convert them to .pdf and overlay OCR so that I can search their content if needed.
Is this possible from the command line so that I can script a .bat/.ps1 file for mass background conversion?
Alternatives?
Thanks, Folks.
User avatar
Sean - PDF-XChange
Site Admin
Posts: 1479
Joined: Wed Sep 14, 2016 5:42 pm

Re: Convert image to PDF + OCR from command line

Post by Sean - PDF-XChange »

Hi margian,

Yes, this is possible using PDF-Tools, which enables you to combine multiple actions into a single custom tool and subsequently run that tool from the command line.

You could for example create a custom tool that contains the following sequence of actions:

Choose Input Files
Create PDF from Images
OCR Pages
Save Documents

You can then configure the settings for each action as desired, including the OCR output type and the location in which the resulting documents are saved. Further information on creating custom tools is available here:

https://help.pdf-xchange.com/pdfxp11/create-tool_t.html

When you have created your custom tool, right-click it and select 'Copy Tool Identifier'. You can then use the /RunTool command to run the tool from the command line, specifying the tool identifier and the folder containing your images. Further information on the available command line options is available here:

https://help.pdf-xchange.com/pdfxt9/com ... ons_t.html

Alternatively, you could use the Folder Monitor feature of PDF-Tools to automate this process whenever new images are added to a specified folder, avoiding the need to create a script.

Kind regards,
Sean Godley
Technical Writer
PDF-XChange Co LTD
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623