OCR "Error opening data file ././deu.dat"

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
baumunk
User
Posts: 38
Joined: Fri Nov 13, 2020 8:47 am

OCR "Error opening data file ././deu.dat"

Post by baumunk »

I have the following errors with PlugIn and OCR:
bild3.JPG
Error opening data file ././deu.dat
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'deu'

I searched for it in forum, there should exist folder PluginsData in the folder with language files (du.dat).

I have created it but it still does not work.

Code:

Code: Select all

int nID = Inst.Str2ID("op.openDoc", false);
            PDFXEdit.IOperation Op = Inst.CreateOp(nID);
            PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)Inst.GetExtension("AFS");
            PDFXEdit.IAFS_Name name = fsInst.DefaultFileSys.StringToName(testfile);
            var input = Op.Params.Root["Input"];
            input.v = name;
            PDFXEdit.ICabNode options = Op.Params.Root["Options"];
            options["NativeOnly"].v = true;
            Op.Do();
            var doc2 = (IPXC_Document)Op.Params.Root["Output"].v;
            nID = Inst.Str2ID("op.document.OCRPages", false);
            Op = Inst.CreateOp(nID);
            PDFXEdit.ICabNode input2 = Op.Params.Root["Input"];
            input2.v = doc2;
            PDFXEdit.ICabNode options2 = Op.Params.Root["Options"];
            options2["PagesRange.Type"].v = "All"; //OCR all pages
            options2["OutputType"].v = 0;
            options2["OutputDPI"].v = 300;
            options2["ExtParams.Language"].v = "deu+eng";
            Inst.AsyncDoAndWaitForFinish(Op);
            doc2.WriteToFile(testfile_ocr);
best regards
Ernest Baumunk
Attachments
bild2.JPG
bild1.JPG
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: OCR "Error opening data file ././deu.dat"

Post by Sasha - Tracker Dev Team »

Hello baumunk,

When initializing the plugin's engine, the plugin takes the languages from the GetStdFolder(PXV_StdFolder_OCRLanguages) folder.
What you are doing is giving it the GetStdFolder(PXV_StdFolder_Common) + "Tesseract\\" folder.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
baumunk
User
Posts: 38
Joined: Fri Nov 13, 2020 8:47 am

Re: OCR "Error opening data file ././deu.dat"

Post by baumunk »

Hello Alex

OCR is now running correctly, thanks to you.

I still have a question about the result "sample_pages_ocr.pdf".
If with xChange Editor I can search for "Klaus kundig":

"xchange.jpg"
it is correct, but with abode (Adobe.JPG) Reader it is not.

Is it because I made with test license?

With PDF-XChange PRO SDK (with real license) it worked correctly.
SampleFiles.rar
(206.17 KiB) Downloaded 50 times
Xchange.JPG
Ernest
Attachments
Adobe.JPG
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: OCR "Error opening data file ././deu.dat"

Post by Sasha - Tracker Dev Team »

Hello baumunk,

As this is a demo of the OCR, it randomly inserts garbage text.
But, I could not recreate the issue with acrobat - you can open the Content pane in both programs and see the invisible text content items - the boxes are similar.
image.png
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply