CharRect Reversed?

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, 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
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

CharRect Reversed?

Post by DolphinMann »

I can't seem to figure out what I am doing incorrect here, but the character coordinates seem reversed for a document i am working with. It's almost like it is rotating the document prior to OCR or something. it is NOT all documents as I have confirmed most are working correctly. There is a barcode on the document as well.

OCR Code: No failures, works on all documents

Code: Select all

                        Init();
                        PDFXEdit.IPXC_Inst pxcInst = (PDFXEdit.IPXC_Inst)viewerInstance.GetExtension("PXC");
                        doc = pxcInst.OpenDocumentFromFile(inputPDF, clbk);

                        int nID = viewerInstance.Str2ID("op.document.OCRPages", false);
                        Op = viewerInstance.CreateOp(nID);
                        input = Op.Params.Root["Input"];
                        input.v = doc;
                        options = Op.Params.Root["Options"];

                        if (pages.Length == 0 || (pages.Length == 1 && pages[0] == -1))
                        {
                            options["PagesRange.Type"].v = "All";
                        }
                        else
                        {
                            options["PagesRange.Type"].v = "Exactly";
                            string pageValues = "";
                            for (int count = 0; count < pages.Length; count++)
                            {
                                if (pageValues != "")
                                {
                                    pageValues += ",";
                                }

                                pageValues += Convert.ToString(pages[count]);
                            }

                            options["PagesRange.Text"].v = pageValues;
                        }

                        options["OutputType"].v = 0;
                        options["OutputDPI"].v = 300;

                        Logger.Log("Attempting to execute OCR on document: " + inputPDF, 5);
                        Op.Do();

                        doc.WriteToFile(inputPDF);
                        Logger.Log("PDF File: " + inputPDF + " had OCR completed", 5);

                        doc.Close();
                        options.Clear();
                        input.Clear();
                        pxcInst = null;
Attempt to read the text to do various things with it, Code:

Code: Select all

                    IPXC_PageText pageText = this.pdf.Pages[count].GetText(null);

                    PXC_TextCharFlags lineStart = PXC_TextCharFlags.TCF_LineBegin;
                    PXC_TextCharFlags paraStart = PXC_TextCharFlags.TCF_ParaBegin;
                    //PXC_TextCharFlags wordStart = PXC_TextCharFlags.TCF_WordBegin;
                    PXC_TextCharFlags wordStop = PXC_TextCharFlags.TCF_WhiteSpace | PXC_TextCharFlags.TCF_WordSeparator | PXC_TextCharFlags.TCF_SearchWordSeparator | PXC_TextCharFlags.TCF_SyntheticSpace;

                    DolphinOCRWordBlock ocrWordBlock = null;
                    DolphinOCRLine ocrLine = null;
                    string formingWord = "";
                    double startingX = 0;
                    double startingY = 0;
                    DolphinOCRCharacter prevChar = null;

                    for (uint charLoop = 0; charLoop < pageText.CharsCount; charLoop++)
                    {
                        string charInfo = Convert.ToString(Convert.ToChar(pageText.Char[charLoop]));
                        uint flags = 0;
                        pageText.GetCharsFlags(charLoop, 1, out flags);
			pageText.CharRect[charLoop]; // I actually do more stuff with this but not important for this part.
		    }
I attached the offending document.

The very first character, position 0 in the code above, correctly return a "B". Also if I load this document in a PDF viewer and attempt to select the text I also get "B", yet my code produces the data below:

Convert.ToString(Convert.ToChar(pageText.Char[0]))
"B"
pageText.CharRect[0]
{PDFXCoreAPI.PXC_Rect}
bottom: 345.83999633789062
left: 62.989992141723633
right: 76.390002250671387
top: 352.67475080490112


At first I was wondering if I had some type of matrix transformation incorrect but it appears as though the "Bottom" and "Left" values are completely swapped. I can other type of documents and I get exact coordinates. Any advice?
Attachments
Blank_no signature.pdf
(447.97 KiB) Downloaded 173 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: CharRect Reversed?

Post by Sasha - Tracker Dev Team »

Hello DolphinMann,

Please download the latest version of the CoreAPI demo and try doing the "9.3. Convert from PDF to txt file" - it contains the code that you can experiment with.
Here's the link to github:
https://github.com/tracker-software/PDFCoreSDKExamples

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: CharRect Reversed?

Post by DolphinMann »

Alex,

Thank you, there does seem to be some code in there that will make a few things easier, however I was specifically asking about the coordinates of the characters.

In your example you seem to be working with "lines" and it was generally sorting by coordinates and providing text. I was acquiring the text fine, it just seemed like the coordinates are reversed.

Upon further inspection, I loaded the same document I uploaded to this thread in to the "FullDEMO" application provided by Tracker Software, with no modifications other than my developers key. I noticed something immediately, even before any attempt at OCR, that may be the source of my X and Y getting reversed for this group of documents(and only this group).

I attached an image showing that the "PageRotation" is showing as 90, but clearly it is upright and correct. Is the reason for this due to the barcode or other lines on the form? Where is the page rotation specifically coming from?
rotationbutwhy.jpg
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: CharRect Reversed?

Post by DolphinMann »

Another side note. I upgraded to 7.0.326.1(just did this today) and OCR is now completely failing as in a hard crash on the Op.Do line.

All other functions and code of my program work as normal, but just OCR, which is the only plugin I use, is failing. I cannot find any information in the logs or Event Viewer other than the record of a hard crash.

Did something change with the plugin on how I need to load or utilize it? This just happened so I will continue to diagnose the issue but I wasn't sure if something else occurred.

I just inserted this code in to the full DEMO application to make sure it was not my program and the entire thing crashes on Op.Do

Code: Select all

                PDFXEdit.IPXC_Inst pxcInst = (PDFXEdit.IPXC_Inst)pdfCtl.Inst.GetExtension("PXC");

                PDFXEdit.IOperation Op = null;
                PDFXEdit.ICabNode options = null;
                PDFXEdit.ICabNode input = null;

                int nID = pdfCtl.Inst.Str2ID("op.document.OCRPages", false);
                Op = pdfCtl.Inst.CreateOp(nID);
                input = Op.Params.Root["Input"];
                input.v = doc.CoreDoc;
                options = Op.Params.Root["Options"];
                options["PagesRange.Type"].v = "All";

                options["OutputType"].v = 0;
                options["OutputDPI"].v = 300;
                
                Op.Do();
Faulting application name: FullDemo.exe, version: 1.0.239.0, time stamp: 0x5b8439c7
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x7411cb49
Faulting process id: 0x8aa4
Faulting application start time: 0x01d43e2e5fd44195
Faulting application path: C:\Program Files (x86)\Tracker Software\Editor SDK\Samples\CSharp\FullDemo\bin\x86\Debug\FullDemo.exe
Faulting module path: unknown
Report Id: c68f1653-aa21-11e8-80c4-463500000031
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: CharRect Reversed?

Post by DolphinMann »

I downloaded the sample app from this thread: viewtopic.php?f=66&t=30356&p=121921&hil ... vp#p121921

and made no changes. This seems to work, so I can only imagine I am not loading a DLL or plugin correctly or in a location that is unxpected. I will research further, but I am still having the rotation issue with the first page of the document i uploaded

What would cause the demo app I downloaded to work and mine to hard crash(when it worked previously)? I did upgrade from 6.X to the new 7.0 DLL's.

My best guess is that I am loading the DLL's from a different place or something, but not sure how the DEMO app I downloaded doesn't do the same

Crash Info:
Version=1
EventType=BEX
EventTime=131798711327767417
ReportType=2
Consent=1
UploadTime=131798711328528177
ReportIdentifier=08205ba8-aa2e-11e8-80c4-463500000031
IntegratorReportIdentifier=08205ba7-aa2e-11e8-80c4-463500000031
WOW64=1
Response.BucketId=50
Response.BucketTable=5
Response.type=4
Sig[0].Name=Application Name
Sig[0].Value=DocumentCaptureDemo.exe
Sig[1].Name=Application Version
Sig[1].Value=5.1.239.0
Sig[2].Name=Application Timestamp
Sig[2].Value=5b844e86
Sig[3].Name=Fault Module Name
Sig[3].Value=StackHash_9e6c
Sig[4].Name=Fault Module Version
Sig[4].Value=0.0.0.0
Sig[5].Name=Fault Module Timestamp
Sig[5].Value=00000000
Sig[6].Name=Exception Offset
Sig[6].Value=7411cb49
Sig[7].Name=Exception Code
Sig[7].Value=c0000005
Sig[8].Name=Exception Data
Sig[8].Value=00000008
DynamicSig[1].Name=OS Version
DynamicSig[1].Value=6.1.7601.2.1.0.256.48
DynamicSig[2].Name=Locale ID
DynamicSig[2].Value=1033
DynamicSig[22].Name=Additional Information 1
DynamicSig[22].Value=9e6c
DynamicSig[23].Name=Additional Information 2
DynamicSig[23].Value=9e6ce83687936ebd04155c85fda49969
DynamicSig[24].Name=Additional Information 3
DynamicSig[24].Value=8ee5
DynamicSig[25].Name=Additional Information 4
DynamicSig[25].Value=8ee5a2d4bdcca62c1160dff62a59fd9e
UI[2]=C:\Dolphin\Development\DocumentCommandCenter\dcc-net-dev\DocumentCaptureDemo\bin\x86\Debug\DocumentCaptureDemo.exe
UI[3]=DocumentCaptureDemo has stopped working
UI[4]=Windows can check online for a solution to the problem.
UI[5]=Check online for a solution and close the program
UI[6]=Check online for a solution later and close the program
UI[7]=Close the program
LoadedModule[0]=C:\Dolphin\Development\DocumentCommandCenter\dcc-net-dev\DocumentCaptureDemo\bin\x86\Debug\DocumentCaptureDemo.exe
LoadedModule[1]=C:\Windows\SysWOW64\ntdll.dll
LoadedModule[2]=C:\Windows\syswow64\kernel32.dll
LoadedModule[3]=C:\Windows\syswow64\KERNELBASE.dll
LoadedModule[4]=C:\Windows\System32\SYSFER.DLL
LoadedModule[5]=C:\Windows\system32\mscoree.dll
LoadedModule[6]=C:\Windows\syswow64\ADVAPI32.dll
LoadedModule[7]=C:\Windows\syswow64\msvcrt.dll
LoadedModule[8]=C:\Windows\SysWOW64\sechost.dll
LoadedModule[9]=C:\Windows\syswow64\RPCRT4.dll
LoadedModule[10]=C:\Windows\syswow64\SspiCli.dll
LoadedModule[11]=C:\Windows\syswow64\CRYPTBASE.dll
LoadedModule[12]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll
LoadedModule[13]=C:\Windows\syswow64\SHLWAPI.dll
LoadedModule[14]=C:\Windows\syswow64\GDI32.dll
LoadedModule[15]=C:\Windows\syswow64\USER32.dll
LoadedModule[16]=C:\Windows\syswow64\LPK.dll
LoadedModule[17]=C:\Windows\syswow64\USP10.dll
LoadedModule[18]=C:\Windows\system32\IMM32.DLL
LoadedModule[19]=C:\Windows\syswow64\MSCTF.dll
LoadedModule[20]=C:\Windows\system32\VERSION.dll
LoadedModule[21]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
LoadedModule[22]=C:\Windows\system32\MSVCR120_CLR0400.dll
LoadedModule[23]=C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\06b781a8e94c9eafd764737490baf614\mscorlib.ni.dll
LoadedModule[24]=C:\Windows\syswow64\ole32.dll
LoadedModule[25]=C:\Windows\system32\uxtheme.dll
LoadedModule[26]=C:\Windows\system32\api-ms-win-core-xstate-l2-1-0.dll
LoadedModule[27]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll
LoadedModule[28]=C:\Windows\syswow64\OLEAUT32.dll
LoadedModule[29]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System\52d3d99bd08a20c8f4b604b2fbd1980c\System.ni.dll
LoadedModule[30]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Drawing\8ec4fb013fcf4c7ebd7201218fc96172\System.Drawing.ni.dll
LoadedModule[31]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Windows.Forms\b82dbab18ba33e77608112f6692dbe1e\System.Windows.Forms.ni.dll
LoadedModule[32]=C:\Windows\system32\CRYPTSP.dll
LoadedModule[33]=C:\Windows\system32\rsaenh.dll
LoadedModule[34]=C:\Windows\system32\RpcRtRemote.dll
LoadedModule[35]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Core\f9dc9d1ca1eb55c5912db7a27571c720\System.Core.ni.dll
LoadedModule[36]=C:\Windows\assembly\NativeImages_v4.0.30319_32\Microsoft.CSharp\0bd8e3a41ddcad020bc11f23ce0c8df4\Microsoft.CSharp.ni.dll
LoadedModule[37]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Configuration\e2e9c3f3eff50ddab324cc884bcfa058\System.Configuration.ni.dll
LoadedModule[38]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\nlssorting.dll
LoadedModule[39]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xml\762c7fef7701d635136e44ff50e00d50\System.Xml.ni.dll
LoadedModule[40]=C:\Windows\syswow64\shell32.dll
LoadedModule[41]=C:\Windows\syswow64\profapi.dll
LoadedModule[42]=C:\Windows\system32\bcrypt.dll
LoadedModule[43]=C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.18837_none_ec86b8d6858ec0bc\comctl32.dll
LoadedModule[44]=C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_41e855142bd5705d\comctl32.dll
LoadedModule[45]=C:\Windows\system32\dwmapi.dll
LoadedModule[46]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data\459ab0ed425a8314c5e5135980e34d16\System.Data.ni.dll
LoadedModule[47]=C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll
LoadedModule[48]=C:\Windows\syswow64\WS2_32.dll
LoadedModule[49]=C:\Windows\syswow64\NSI.dll
LoadedModule[50]=C:\Windows\syswow64\CRYPT32.dll
LoadedModule[51]=C:\Windows\syswow64\MSASN1.dll
LoadedModule[52]=C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23894_none_5c0be957a009922e\gdiplus.dll
LoadedModule[53]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data7706cdc8#\3c5c74a1a600bc95f8404157c2304dd3\System.Data.DataSetExtensions.ni.dll
LoadedModule[54]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Numerics\22ca8fddd0b01578414a7c8553b1b247\System.Numerics.ni.dll
LoadedModule[55]=C:\Windows\syswow64\CLBCatQ.DLL
LoadedModule[56]=C:\Program Files (x86)\Dolphin\Document Command Center\PDFXEditCore.x86.dll
LoadedModule[57]=C:\Windows\syswow64\urlmon.dll
LoadedModule[58]=C:\Windows\syswow64\api-ms-win-downlevel-ole32-l1-1-0.dll
LoadedModule[59]=C:\Windows\syswow64\api-ms-win-downlevel-shlwapi-l1-1-0.dll
LoadedModule[60]=C:\Windows\syswow64\api-ms-win-downlevel-advapi32-l1-1-0.dll
LoadedModule[61]=C:\Windows\syswow64\api-ms-win-downlevel-user32-l1-1-0.dll
LoadedModule[62]=C:\Windows\syswow64\api-ms-win-downlevel-version-l1-1-0.dll
LoadedModule[63]=C:\Windows\syswow64\api-ms-win-downlevel-normaliz-l1-1-0.dll
LoadedModule[64]=C:\Windows\syswow64\normaliz.DLL
LoadedModule[65]=C:\Windows\syswow64\iertutil.dll
LoadedModule[66]=C:\Windows\syswow64\WININET.dll
LoadedModule[67]=C:\Windows\syswow64\USERENV.dll
LoadedModule[68]=C:\Windows\syswow64\PSAPI.DLL
LoadedModule[69]=C:\Windows\system32\WINSPOOL.DRV
LoadedModule[70]=C:\Windows\syswow64\COMDLG32.dll
LoadedModule[71]=C:\Windows\system32\MSIMG32.dll
LoadedModule[72]=C:\Windows\system32\WINMM.dll
LoadedModule[73]=C:\Windows\system32\mscms.dll
LoadedModule[74]=C:\Windows\system32\MPR.dll
LoadedModule[75]=C:\Windows\syswow64\SETUPAPI.dll
LoadedModule[76]=C:\Windows\syswow64\CFGMGR32.dll
LoadedModule[77]=C:\Windows\syswow64\DEVOBJ.dll
LoadedModule[78]=C:\Windows\system32\api-ms-win-core-synch-l1-2-0.DLL
LoadedModule[79]=C:\Windows\system32\SXS.DLL
LoadedModule[80]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Serv759bfb78#\0672fb591497d653be2577071e88b8cb\System.ServiceProcess.ni.dll
LoadedModule[81]=C:\Windows\system32\Secur32.dll
LoadedModule[82]=C:\Windows\system32\api-ms-win-downlevel-advapi32-l2-1-0.dll
LoadedModule[83]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Transactions\8ac105d5780d99aeb26f6e452452fabb\System.Transactions.ni.dll
LoadedModule[84]=C:\Windows\Microsoft.Net\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll
LoadedModule[85]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Ente96d83b35#\6e8a19ddacfbc630a5bb3d78d2cacd07\System.EnterpriseServices.ni.dll
LoadedModule[86]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Ente96d83b35#\6e8a19ddacfbc630a5bb3d78d2cacd07\System.EnterpriseServices.Wrapper.dll
LoadedModule[87]=C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll
LoadedModule[88]=C:\Windows\system32\security.dll
LoadedModule[89]=C:\Windows\system32\credssp.dll
LoadedModule[90]=C:\Windows\SysWOW64\schannel.dll
LoadedModule[91]=C:\Windows\SysWOW64\Kerberos.DLL
LoadedModule[92]=C:\Windows\system32\cryptdll.dll
LoadedModule[93]=C:\Windows\SysWOW64\msv1_0.DLL
LoadedModule[94]=C:\Windows\system32\ntdsapi.dll
LoadedModule[95]=C:\Windows\system32\netapi32.dll
LoadedModule[96]=C:\Windows\system32\netutils.dll
LoadedModule[97]=C:\Windows\system32\srvcli.dll
LoadedModule[98]=C:\Windows\system32\wkscli.dll
LoadedModule[99]=C:\Windows\system32\LOGONCLI.DLL
LoadedModule[100]=c:\Program Files (x86)\Microsoft SQL Server\90\Shared\instapi.dll
LoadedModule[101]=C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6229_none_d089f796442de10e\MSVCR80.dll
LoadedModule[102]=C:\Windows\system32\mswsock.dll
LoadedModule[103]=C:\Windows\System32\wshtcpip.dll
LoadedModule[104]=C:\Windows\System32\wship6.dll
LoadedModule[105]=C:\Windows\system32\DNSAPI.dll
LoadedModule[106]=C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
LoadedModule[107]=C:\Program Files (x86)\Bonjour\mdnsNSP.dll
LoadedModule[108]=C:\Windows\system32\Iphlpapi.DLL
LoadedModule[109]=C:\Windows\system32\WINNSI.DLL
LoadedModule[110]=C:\Windows\system32\rasadhlp.dll
LoadedModule[111]=C:\Windows\System32\fwpuclnt.dll
LoadedModule[112]=C:\Windows\system32\ncrypt.dll
LoadedModule[113]=C:\Windows\SysWOW64\bcryptprimitives.dll
LoadedModule[114]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Runt19c51595#\1117401fde630e795d6e6cc2ef54f96d\System.Runtime.Caching.ni.dll
LoadedModule[115]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Dynamic\5f266ff02aa18b55f1c05efb47aed4d3\System.Dynamic.ni.dll
LoadedModule[116]=C:\Program Files (x86)\Dolphin\Document Command Center\OCRPlugin.pvp
LoadedModule[117]=C:\Program Files (x86)\Dolphin\Document Command Center\ConvertPDF.pvp
LoadedModule[118]=C:\Windows\system32\dbghelp.dll
LoadedModule[119]=C:\Program Files (x86)\Common Files\microsoft shared\ink\tiptsf.dll
LoadedModule[120]=C:\Program Files (x86)\Dolphin\Document Command Center\PDFXCoreAPI.x86.dll
LoadedModule[121]=C:\Windows\System32\msxml6.dll
State[0].Key=Transport.DoneStage1
State[0].Value=1
State[1].Key=DataRequest
State[1].Value=Bucket=50/nBucketTable=5/nResponse=1/n
FriendlyEventName=Stopped working
ConsentKey=BEX
AppName=DocumentCaptureDemo
AppPath=C:\Dolphin\Development\DocumentCommandCenter\dcc-net-dev\DocumentCaptureDemo\bin\x86\Debug\DocumentCaptureDemo.exe
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: CharRect Reversed?

Post by DolphinMann »

Don't want to derail the original problem, which is that document seems to think it's rotated 90 degrees, which is causing coordinate issues BUT I *think* I solved the OCR issue

I had downloaded the latest release, 7.0.326.1 and the OCR process kept crashing on me. I then downloaded the OCR sample app from the thread listed above, which was version 7.0.324.22579 of the PDFXEditCore.x86.dll

I switched my application to use the same version as the Sample app(lower version) and OCR is working again.

I think the 7.0.326.1 version may have an issue with the OCR plugin or I am doing something very wrong. once I switched the version back all of my applications began working
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: CharRect Reversed?

Post by Sasha - Tracker Dev Team »

Hello DolphinMann,

Just used the last version release x86.dll - I experienced no crash. Maybe you are using some kind of a document that causes this - or is this reproducible with all of the document that you are using?
As for the rotation - the Page Rotation value is the rotation set in the Page Matrix and can be get/set by this property:
https://sdkhelp.pdf-xchange.com/vi ... e_Rotation

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: CharRect Reversed?

Post by DolphinMann »

Thank you Alex, I am using the same document I uploaded here.

I am familiar with how to set/get the page rotation, i guess my question is different.

The page lists as being rotated 90. I am not sure why, but perhaps it was scanned sideways and then someone "fixed" it.

My question would be that wen I run OCR on that document, I am getting X/Y coordinates swapped, which would make sense for a 90 degree rotation. So

1.) Should OCR report coordinates as they are on the page WITH rotation, meaning accurate X/Y values for the page as it is currently rotated
2.) Is it my responsibility to take the coordinates and then apply a rotation matrix to them? If so is there an easy way to do that or am I better off checking for 90/180/270 and taking a different action depending?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: CharRect Reversed?

Post by Sasha - Tracker Dev Team »

Hello DolphinMann,

From what I see, you should apply the Page Matrix to the coordinates you get from the operation. For this you should use the IAUX_Inst::MathHelper's method IMathHelper::Rect_Transform like you can see in this code snippet from the CoreAPIDemo application:

Code: Select all

			//Getting source page matrix
			PXC_Matrix srcPageMatrix = srcPage.GetMatrix(PXC_BoxType.PBox_PageBox);
			//Getting source page Page Box without rotation
			PXC_Rect srcRect = srcPage.get_Box(PXC_BoxType.PBox_PageBox);
			//Getting visual source Page Box by transforming it through matrix
			auxInst.MathHelper.Rect_Transform(srcPageMatrix, ref srcRect);

You should do the same with the coordinate rectangles.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: CharRect Reversed?

Post by DolphinMann »

Alex,

Thank you again for all of your help. The coordinate matrix transform is working.

However I am still getting a hard crash on the Op.Do for OCR when using 7.0.326.1

is it possible that I need to update my DevKey for using version 7? Is there something else I can provide to help debug this? If I switch versions it works again and it crashes during the Op.Do call so I don't even get a return error code or anything. Not sure what to do as a next step for debugging and I'd like to be on the latest stable if possible.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: CharRect Reversed?

Post by Sasha - Tracker Dev Team »

Hello DolphinMann,

Can you try doing the IPXV_Inst::AsyncDoAndWaitForFinish(Op) and see whether it crashes?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: CharRect Reversed?

Post by DolphinMann »

Alex,

It get the following message when attempting that call:
error CS1503: Argument 1: cannot convert from 'PDFXEdit.IOperation [DocumentCaptureDemo, Version=5.1.243.0, Culture=neutral, PublicKeyToken=null]' to 'PDFXEdit.IOperation [Interop.PDFXEdit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]'

Obviously the "Document Capture Demo" is my application name in this case.

It seems most of the PDF functions and calls still work, but something is not right, probably on my end but I cannot figure it out.

I am only getting failures on certain Op.Do commands
Exporting to TIF
OCR
Converting to PDF
etc

The basic use of the Core and Edit library seem to work. I can get the UI to load and I can open a document, etc. I could use some help here as I've been down for a few days now.

I can confirm the correct version of the DLL is loaded via Process.GetCurrentProcess().Modules
DolphinMann
User
Posts: 158
Joined: Mon Aug 04, 2014 7:34 pm

Re: CharRect Reversed?

Post by DolphinMann »

I reverted to version 7.0.324.3 and it is working again. No changes in code.

I will continue to use that for now but I'd like to try and resolve the other issue. Let me know what else I can do.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: CharRect Reversed?

Post by Sasha - Tracker Dev Team »

Hello DolphinMann,

Can you please try the OCR code that crashes in the clean FullDemo application while using the new dll (through regsvr32 or through the manifest).

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