Tiff to Searchable PDF

PDF-X OCR SDK is a New product from us and intended to compliment our existing PDF and Imaging Tools to provide the Developer with an expanding set of professional tools for Optical Character Recognition tasks

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

Post Reply
xtreme1
User
Posts: 11
Joined: Mon Apr 30, 2012 1:35 pm

Tiff to Searchable PDF

Post by xtreme1 »

I need to convert thousands of tiff and other image formats to searchable PDF's. Can you provide some sample on how to accomplish this using C#?
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Tiff to Searchable PDF

Post by Tracker Supp-Stefan »

Hi xtreme1,

It's not currently possible to directly OCR an image using our OCR SDK:
https://forum.pdf-xchange.com/ ... 42&t=12666

But it's certainly possible to create a PDF file from image(s) - e.g. using the Tools SDK, and then call the OCR to add the layer of searchable text in your files.

We do not have a single example that will do both - but if you download our PDF XChange Pro SDK:
https://www.pdf-xchange.com/product ... ge-pro-sdk
You will find samples for both PDF Creation, as well as for OCRing existing PDF files.

Best,
Stefan
xtreme1
User
Posts: 11
Joined: Mon Apr 30, 2012 1:35 pm

Re: Tiff to Searchable PDF

Post by xtreme1 »

Do you have samples in C#?
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Tiff to Searchable PDF

Post by Tracker Supp-Stefan »

Hi xtreme1,

Yes we do :)

Cheers,
Stefan
xtreme1
User
Posts: 11
Joined: Mon Apr 30, 2012 1:35 pm

Re: Tiff to Searchable PDF

Post by xtreme1 »

Okay... Can you please share?

I downloaded the Pro SDK and the only OCR examples you have are C, Delphi and VB.

Thanks for your help....

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

Re: Tiff to Searchable PDF

Post by Walter-Tracker Supp »

Actually we do not currently have an OCR C# sample, however this is something we are hoping to add in the next little while. I realize this does not help you much, as you are looking for a solution right now, but we added the OCR SDK as a free bonus feature a couple of months ago and as such have not added as many examples as some of our other projects have (although, as with all our products, we continue to resolve critical bugs in a timely manner). We have a much more elaborate solution coming out in the next version of the SDKs, sometime later in the year.

Meanwhile, if you were industrious you could implement a C# wrapper by following the existing examples for the other SDKs. It really would not be much difficulty to look at the C header files and create the C# implementation by following the example for, e.g., the Simple Viewer DLL. It would probably only take a day or two to do this.

But this will be up to you to implement unless you are content to wait a few weeks (as we are quite busy finalizing our new major version of the PDF XChange Viewer and our development resources are heavily focused).
xtreme1
User
Posts: 11
Joined: Mon Apr 30, 2012 1:35 pm

Re: Tiff to Searchable PDF

Post by xtreme1 »

Thanks...I need to determine if OCR library is the right solution. Can you you provide a little more guidance on how to create the wrapper. Which library files and header files to include?

thanks,

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

Re: Tiff to Searchable PDF

Post by Walter-Tracker Supp »

xtreme1 wrote:Thanks...I need to determine if OCR library is the right solution. Can you you provide a little more guidance on how to create the wrapper. Which library files and header files to include?

thanks,

Rob
The C++ header files, ocrtools.h and ocr_types.h, contain the structures and functions you need to declare in C#.

If you look at the C# example in (PDF Tools PRO SDK InstallationDirectory)\Examples\SDKExamples\C#Examples\PDFXC_Funcs.cs, you should see roughly how to implement them in C#.

However I will see if we can accellerate this and put something out in the next day or two. I will respond back in an hour or so with a verdict on whether we can divert some resources to this or not.
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: Tiff to Searchable PDF

Post by Walter-Tracker Supp »

We are working on this now and should hope to have a demo and wrapper ready in the next day or so.

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

Re: Tiff to Searchable PDF

Post by Walter-Tracker Supp »

A preliminary version of the C# demo is complete. Please find it attached.

This is not an official release, and won't be included in the SDK installer until we have had a chance to more thoroughly test it. Please ensure you test it rigorously before putting it into production, or wait until we have officially supported it (when we put it in the downloadable installer for the SDK).
Attachments
OCRDemoCsharp.7z
(45.65 KiB) Downloaded 289 times
xtreme1
User
Posts: 11
Joined: Mon Apr 30, 2012 1:35 pm

Re: Tiff to Searchable PDF

Post by xtreme1 »

I am receiving an missing DLL error:
Unable to load DLL 'ocrtools': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: Tiff to Searchable PDF

Post by Walter-Tracker Supp »

xtreme1 wrote:I am receiving an missing DLL error:
Unable to load DLL 'ocrtools': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Yes, you need to download the SDK and copy the DLL (ocrtools.dll, or ocrtools-x64.dll (64 bit)) to your project executable directory. If you use the 64 bit DLL you need to either rename it to ocrtools.dll, or change the import statements in the C# source file that declares the dll-exported functions..

ie, to use the ocrtools-x64.dll binary, in PDFXOCR_Funcs.cs, change all instances of:

Code: Select all

        [DllImport("ocrtools")] 
to

Code: Select all

        [DllImport("ocrtools-x64")] 
We may just change the source to handle this automatically. For now the easiest way is to just rename the 64 bit binary if you are creating a 64 bit build.

The attachment is only the example code for the C# project, not the executable dll.
xtreme1
User
Posts: 11
Joined: Mon Apr 30, 2012 1:35 pm

Re: Tiff to Searchable PDF

Post by xtreme1 »

:D Thanks... I was able to locate it and use the sample code to OCR one of our docs to searchable PDF. I appreciate the support...
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: Tiff to Searchable PDF

Post by Walter-Tracker Supp »

No problem. It's been on the TO-DO list for awhile and your request was the final push we needed.

We haven't yet tested all the functionality in the wrapper, so if you come upon any problems please contact us and we will fix them.

We will be conducting our own testing over the next week or so, and will update the main SDK installer once that is done.

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

Re: Tiff to Searchable PDF

Post by Walter-Tracker Supp »

Please note that I have found a bug in the wrapper; an "int" type has been used for some pointers, where in fact an IntPtr type is needed to ensure full interoperability for both 32 and 64 bit versions. I am making the changes and will post an update shortly.
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: Tiff to Searchable PDF

Post by Walter-Tracker Supp »

Here is the fixed C# demo application.
Attachments
OCRDemoCsharp.7z
(46.62 KiB) Downloaded 270 times
xtreme1
User
Posts: 11
Joined: Mon Apr 30, 2012 1:35 pm

Re: Tiff to Searchable PDF

Post by xtreme1 »

I have started to work with the ocrtools with C# and have found that only the first 2 pages get saved even though the callback appears to be working on all pages. This occurs with the 32 bit version of the ocrDemoCsharp.
Is there something missing in the demo that only saves the 1st 2 pages? :?
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: Tiff to Searchable PDF

Post by John - Tracker Supp »

Yes - in the demo for the SDK, you can only save 2 pages - you need a full license to be able to use the SDK and save all the results.

Also - please note you are posting in the drivers forum - for the end user product - please post in the correct Developer SDK forum (e.g here ;)

https://forum.pdf-xchange.com/ ... m.php?f=42

to ensure the correct staff member answers your post promptly
thanks
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
xtreme1
User
Posts: 11
Joined: Mon Apr 30, 2012 1:35 pm

Re: Tiff to Searchable PDF

Post by xtreme1 »

I do have a license

:?
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6831
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Tiff to Searchable PDF

Post by Paul - Tracker Supp »

Hi xtreme1,

don't post your serial number here, but do tell me if you are able to do other things that requires a license without getting water marks. that would be a sign that the serial key is not being passed properly and that your app is actually running in trial mode.

If it's just the 2 page limitation that is an issue for you then it might be more than just a licensing issue. Can you confirm that your app is passing the serial key properly for other functionality?

regards
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: Tiff to Searchable PDF

Post by John - Tracker Supp »

What Paul has omiited to tell you is the OCR SDK requires you use a 'live' DLL to function without the trial limitations.

Please email support@pdf-xchange.com with your full license details - if you have the full PDF-XChange PRO SDK we will provide you with the necessary details - please note - only the full PDF-XChange PRO SDK includes the use of the OCR SDK, PDF-Tools and Drivers SDK's for example do not !

HTH
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
xtreme1
User
Posts: 11
Joined: Mon Apr 30, 2012 1:35 pm

Re: Tiff to Searchable PDF

Post by xtreme1 »

I've sent my license information to support... Please let me know what I need to do to get the "live" ocrtools dll....

Thanks,

Rob :D
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: Tiff to Searchable PDF

Post by John - Tracker Supp »

Hi Rob,

I believe a colleague has already dealt with this - if not - please do come back.

Thanks
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
MWisniewski
User
Posts: 11
Joined: Wed Feb 27, 2013 8:21 pm

Re: Tiff to Searchable PDF

Post by MWisniewski »

Hi, I am trying to dowload OCRDemoCsharp.7z file and its not in the correct format. Can anyone please help, i am trying to run the demo example code for the OCR. Thanks. the one i got from the SDK 5.0. complains about the dll not found. Thanks.
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: Tiff to Searchable PDF

Post by Walter-Tracker Supp »

MWisniewski wrote:Hi, I am trying to dowload OCRDemoCsharp.7z file and its not in the correct format. Can anyone please help, i am trying to run the demo example code for the OCR. Thanks. the one i got from the SDK 5.0. complains about the dll not found. Thanks.
OCRDemoCSharp.7z is a 7-zip file - you will need 7-Zip from http://www.7-zip.org/ to uncompress it. However the contents are the same as the demo included in the SDK.

There are two builds of the OCR DLL (which is a native / non-managed DLL created in C++, incidentally - ie., not a .NET assembly) - one for 64 bit and one for 32 bit. They are found in:

(installpath)\PDF-XChange PRO 5 SDK\Examples\Bin

and

(installpath)\PDF-XChange PRO 5 SDK\Examples\Bin.x64

All the DLL's functions are imported by PDFXOCR_Funcs.cs using the unmanaged DLL import attribute [DllImport("ocrtools")]. Because of the way it is specified it searches for "ocrtools.dll" in the current search path (usually the executable's running directory - ie the location of OCRDemoCSharp.exe).

There are two ways to set it up so that it runs for you.

1. You can modify the path "ocrtools" to point to a specific DLL:

For example, for 64 bit, change the DllImport attributes to: [DllImport("C:\\Program Files\\Tracker Software\\PDF-XChange PRO 5 SDK\\Examples\\Bin.x64\\ocrtools-x64.dll")]

2. You can copy the DLL to the search path (ie, the built executable's directory).

Where this is will depend on how you configure your build environment, but on my system, using the default installation of PDF Tools SDK 5, and in x64 Debug configuration, it is:

C:\Program Files\Tracker Software\PDF-XChange PRO 5 SDK\Examples\OcrSDKExamples\C#Examples\OCRDemoCsharp\OCRDemoCsharp\bin\x64\Debug\

You'll have to make sure to copy the right DLL (64bit or 32bit), and possibly rename it to ocrtools.dll, or change the PDFXOCR_Funcs.cs import attributes to reflect the use of a 64 bit DLL if needed - ie: [DllImport("ocrtools-x64")].




Hope this helps.
MWisniewski
User
Posts: 11
Joined: Wed Feb 27, 2013 8:21 pm

Re: Tiff to Searchable PDF

Post by MWisniewski »

Thanks so much. Your solution :wink: worked.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Tiff to Searchable PDF

Post by Tracker Supp-Stefan »

:)
Post Reply