Trigger OCR Programatically?

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

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

aitchisj
User
Posts: 47
Joined: Mon Apr 04, 2011 4:44 am

Trigger OCR Programatically?

Post by aitchisj »

Hi There,

We have version 2.5.194 ActiveX version of the PDF-XChange Viewer embedded in our application and I can see on one of the menubars and from within the "Document" menu, the "OCR Pages..." feature is available and the button can be clicked, but is there a way to trigger that function programatically? I get the impression that the answer is "no" because I can't seem to find any documentation on it. I just don't understand why not, so any insight you can provide is appreciated. I am trying to use the Viewer to provide the basic functionality we need to integrate OCR into our application. If I can trigger the OCR to run in the Viewer, my problems would be mostly solved. Or... is it the case that I have to purchase the PDF-XChange PRO in order to handle the OCR functionality separately?

Thanks for any help,
-John
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Trigger OCR Programatically?

Post by Stefan - PDF-XChange »

Hello John,

It's strange that you can see the OCR in the AX of build 194 - as we introduced it with build 200 :)

In any case - yes the OCR is a separate module, and in order to use it you will need a Pro SDK license.
You can find more info on the OCR SDK here:
https://www.pdf-xchange.com/pdfxocrmod

Best,
Stefan
aitchisj
User
Posts: 47
Joined: Mon Apr 04, 2011 4:44 am

Re: Trigger OCR Programatically?

Post by aitchisj »

I thought it seemed a bit weird too but I swear it's there and it even works. Why is it that the feature would be available in the control and I can click it manually, but cannot trigger it programatically?

I can understand needing to purchase the PRO SDK separately, but it would be nice if after doing so, I could actually use the "OCR Pages..." function in the Viewer SDK (code calls to trigger it).

I know the OCR button is going to confuse our customers if they attempt to use it from within the Viewer once we actually have a separate OCR solution in place. How can I hide the OCR button in the toolbar and also in the menu? I don't see any way to refer to the button or to the command at all in the documentation.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Trigger OCR Programatically?

Post by Stefan - PDF-XChange »

Hello John,

You should have updated the files to the latest build to see the OCR button.

I will now ask one of my colleagues dealing with OCR to comment on using it directly in the Viewer, and on the ways for you to disable and hide the OCR commands from the Viewer interface.

Best,
Stefan
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: Trigger OCR Programatically?

Post by Walter-Tracker Supp »

In the Active-X Viewer SDK, you can open the OCR dialogue box with the named command "OCRPages" (you can see a list of all commands in the included compiled demo called "FullDemo.exe" included in the "[..installation..]\Bin" directory. Just open a document with the "Document" tab, then select the "Commands" tab to see a list of commands and test execution.

Please note that while you can open the dialogue box, the user must still interact with it to finish OCR. To do it completely programatically you need to use the PRO SDK.

Hope this helps.

-Walter
aitchisj
User
Posts: 47
Joined: Mon Apr 04, 2011 4:44 am

Re: Trigger OCR Programatically?

Post by aitchisj »

Thank you for filling in the blanks! This makes sense. I'm pretty sure that the "OCRPages" command isn't documented in the Viewer SDK Helps, which was part of my confusion, so I will take a look at FullDemo.exe as you have described.

Basically I need to run a batch of documents through OCR instead of doing it one by one, so having the user interact with the dialog for each individual document isn't ideal in which case we will most likely be purchasing the PRO SDK so that we can handle it separately but still use the viewer to display the searchable PDF's.

Thanks a lot for your quick answers and have a great day,
-John 8)
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Trigger OCR Programatically?

Post by John - Tracker Supp »

Pleasure :)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
martin3
User
Posts: 20
Joined: Tue Oct 11, 2011 6:08 am

Re: Trigger OCR Programatically?

Post by martin3 »

Hello John,

may I ask an additional question to this topic. You mentioned that it is possible to open the OCR dialog via the command. But is it also possible to completely automatically control the OCR parameters and trigger the OCR without any user interaction?

To give you an idea about our problem: From time to time we have to deal with PDF files without OCR but users need one. The idea is to integrate a button into our application that creates a copy of the currently displayed PDF, triggers the OCR, and after the user worked with the PDF (e.g. added comments) stores the new PDF back to our content management system. All of that has to be done without user interaction in order to guarantee common OCR parameters and save storage back to the content management system.

Thanks
Martin
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: Trigger OCR Programatically?

Post by Walter-Tracker Supp »

This is not currently possible with the Active-X viewer, however if you have the FULL PDF-XChange Pro SDK (not just the Viewer SDK) with the OCR DLL, you can accomplish it that way in a fully automated manner.

-Walter