OCR Plugin - Languages: none installed  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

OCR Plugin - Languages: none installed

Post by zarkogajic »

Hi support.

I'm loading the OCRPlugin, and the "OCR Pages(s)..." menu item appears under "Document".

However, the "Languages" box lists no languages and the "Add/Update Languages..." is disabled.

image.png

What needs to be done for some languages to appear there?

p.s.
I've browsed the forum and "PluginsData" and "OCRLanguages" folders are mentioned, but none exist with my EU Editor installation:

image.png





-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: OCR Plugin - Languages: none installed

Post by Sasha - Tracker Dev Team »

Hello žarko,

These should be added manually like the topic that you have found suggests.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: OCR Plugin - Languages: none installed

Post by zarkogajic »

Hi Alex,

I've added "OCRLanguages" under added "PluginsData" (same level where my EXE and sdk's DLL is) and I have placed there "eng.lng" and "eng_pxvocr.dat" (found on the forum from 2017) - but the combo is still empty.

Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: OCR Plugin - Languages: none installed

Post by Sasha - Tracker Dev Team »

Hello žarko,

Have you read all of the mentioned topic? From what I remember, the developer there had the same results as you described.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: OCR Plugin - Languages: none installed

Post by zarkogajic »

Hi Alex,

Different topics mention different needed layout. Some mention "Languages" folder at the same level where "plugins" folder is. Some mention "OCRLanguages" folder (under PluginsData).

So am not sure what to follow :(

(and I think I've tried all combinations)

User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: OCR Plugin - Languages: none installed

Post by Vasyl-Tracker Dev Team »

Hi žarko.

You need to organize such files in the following order:

Code: Select all

<EditorSdkFolder>
     Common
         Languages // all UI-languages 
         Dictionaries // all Spellcheck-dictionaries
         Tesseract // all DefaultOCR languages
         ...
     ...
     PDFXEditCore.x86.dll
     PDFXEditCore.x64.dll
HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: OCR Plugin - Languages: none installed

Post by zarkogajic »

Hi Vasyl,

Thanks, unfortunately still nothing in the Languages combo, it is disabled and displays "None Installed", "Add/Update Languages" button is also disabled.

Here's how I have it:

image.png
image.png (13.8 KiB) Viewed 3916 times

I have also tried without the manifest - that is via standard regsvr - same results.

Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: OCR Plugin - Languages: none installed

Post by Sasha - Tracker Dev Team »

Hello žarko,

Will forward this one to Vasyl for investigation.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: OCR Plugin - Languages: none installed

Post by Vasyl-Tracker Dev Team »

Hi žarko.

The "Add/Update Languages" button is disabled in SDK-mode because at the moment we don’t want to overuse the our site by not our customers (i.e. - by your own customers). Sorry.

According to your problem with OCR-Languages: from your screenshot I see that you using too old lang-files. Try to use latest from the:
https://www.pdf-xchange.com/pdf-xchange-ocr
- here are different installers that adding lang-files for the installed PDFXEditor (end-user app), to the folder:
c:\Program Files\Tracker Software\Common\Tesseract
so after installing packs you will be able to copy all necessary files to your own folder.

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: OCR Plugin - Languages: none installed

Post by zarkogajic »

Hi Vasyl,

Ok, that worked - after downloading and installing a few language packs a new "Common\Tesseract" folder was created under "Tracker Software" under "\Program Files".

The "Tesseract" folder has a bunch of ".lng" and ".dat" files. The .lng files are all 1 KB.

Please note that nothing has changed in the EU Editor!

I've then copied those files to my app's directory "\Common\Tesseract\*" - and the Languages combo got filled with languages... so that part is solved.

One question though: during the installation of the packs, additional files were also placed under "\Windows\System32\ocrdats" - those are a bunch of "name.lng" and "name_pxvocr.dat" files. It seems they are duplicates of those in Tesseract folder, having a different name, so that:

"\Program Files\Tracker Software\Comon\Tesseract\name.lng" == "\Windows\System32\ocrdats\name.lng"
"\Program Files\Tracker Software\Comon\Tesseract\name.dat" == "\Windows\System32\ocrdats\name_pxvocr.dat"


Q: For my application setup: should it also place files under "\Windows\System32\ocrdats\" - or are the files under "\Common\Tesseract" enough ?

-žarko
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: OCR Plugin - Languages: none installed

Post by zarkogajic »

Hi support,

Since "Add/Update Languages" is disabled in SDK by default, I'm trying to hide it from that dialog.

I've implemented IUIX_EventMonitor for "DlgOCRPages" but I cannot find (by try/fail) what event code to catch, as it seems it is not any of: "e.InitDialog", "e.Visible", "e.ShowModal".

What event to listen to ?

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: OCR Plugin - Languages: none installed

Post by Sasha - Tracker Dev Team »

Hello žarko,

Forwarded your question about the language packs to Vasyl.
As for the dialog, can you make a screenshot of what you are trying to achieve?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: OCR Plugin - Languages: none installed

Post by zarkogajic »

Hi Alex,

Hide this button:

image.png

User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: OCR Plugin - Languages: none installed  SOLVED

Post by Vasyl-Tracker Dev Team »

Please note that nothing has changed in the EU Editor!
Yes, yesterday, when I tried to reproduce your problem - also I noticed that that OCR-lang-installers add files into location that is obsolete for Editor and Tools applications. For the latest Editor/Tools the correct place should be:
c:\Program Files\Common Files\Tracker Software\Common\
but unfortunately we forget to update such installers according to the needs of latest Editor/Tools. We will fix it soon. I guess this problem was 'masked' by 'Add/Update Languages' feature that allow user to easily add new OCR-langs without using special installers. And I believe - most users prefer to use such simple feature.

during the installation of the packs, additional files were also placed under "\Windows\System32\ocrdats"
We reproduced it. It is issue definitely. Thanks for report. It also will be fixed soon. And for sure, it is enough to fill just your "\Common\Tesseract" folder.

Since "Add/Update Languages" is disabled in SDK by default, I'm trying to hide it from that dialog.
To hide this button you may use the following code:

Code: Select all

public void OnEventMonitor(PDFXEdit.IUIX_Obj pTarget, PDFXEdit.IUIX_Event pEvent)
{
	if (pEvent.Code == (int)PDFXEdit.UIX_EventCodes.e_InitDialog)
	{
		if (pTarget.ID == pTarget.ThreadCtx.Inst.Str2ID("DlgOCRPages2"))
		{
			PDFXEdit.IUIX_Obj btn = pTarget.FindChild(pTarget.ThreadCtx.Inst.Str2ID("btn.addUpdateLangs"), 2);
			if (btn != null)
			{
				btn.Show(0); // SW_HIDE==0
			}
		}
	}
}
HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: OCR Plugin - Languages: none installed

Post by zarkogajic »

Hi Vasyl,

That does it, thanks.

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: OCR Plugin - Languages: none installed

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: OCR Plugin - Languages: none installed

Post by RMan »

Is there a way to enable the command so the button works in the SDK but then point the location of the button to a different url for custom installers of the language packs?


Also anyone else who comes across this post you probably want to also do the same thing in the "DlgAppPrefs.OCR" Preferences Dialog.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: OCR Plugin - Languages: none installed

Post by Sasha - Tracker Dev Team »

Hello RMan,

First you will have to obtain the needed button (btn.addUpdateLangs):

Code: Select all

			PDFXEdit.IUIX_Button GetButton(PDFXEdit.IUIX_Dialog dlg, string sID)
			{
				IntPtr outPtr;
				PDFXEdit.IUIX_Button ctl = null;
				PDFXEdit.IUIX_Obj obj = dlg.GetItem(sID);
				if (obj != null)
				{
					obj.QueryImpl(typeof(PDFXEdit.IUIX_Button).GUID, null, out outPtr);
					ctl = (PDFXEdit.IUIX_Button)System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(outPtr);
				}
				return ctl;
			}
Then you will have to implement a custom event target for the button's object and intercept the click:
viewtopic.php?f=66&t=29426&p=115630&hil ... et#p115630
Don't forget to dispose of it afterwards.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply