[Demo App] Multi-thread Tiff to PDF/OCR

Example requests & Code samples for GdPicture Toolkits.
User avatar
Loïc
Site Admin
Posts: 5592
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

[Demo App] Multi-thread Tiff to PDF/OCR

Post by Loïc » Fri Nov 11, 2011 12:20 pm

-Edit-

Here is a new version (vb.net & c#) based on built-in multitasking support of GdPicture 11.
TIFF to PDF-OCR.zip
(340.24 KiB) Downloaded 220 times
Hi there,

Based on many customer requests we provide a vb.net demo application which aims to convert multipage Tiff document to PDF/OCR using a predefined number of threads.

The app has been created using Visual Studio 2010 (vb language).

Application behavior:
- Expects for user to provide a multipage tiff to convert to PDF/OCR, valid dictionary path and language (default is english)
- Splits the input tiff document in several tiffs (1 file = 1 page)
- Performs OCR in multi-thread mode. 1 page = 1 thread. And create 1 PDF per page
- When OCR is done, the app merges the produced PDFs to a single PDF.

Prerequisites:
- Visual Studio 2010 or higher.
- Install GdPicture.NET 8.4.3 or higher.
- Open the app and replace "XXX" by a valid trial or commercial key.

mtocr.png
TIFF to PDF/OCR multit-hread application screenshot.

Feel free to post any question or comment.

Kind regards,

Loïc
Attachments
mtpdfocr.zip
the app.
(19.55 KiB) Downloaded 498 times

JacobRusso
Posts: 4
Joined: Wed Sep 14, 2011 7:47 pm

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by JacobRusso » Fri Nov 11, 2011 6:40 pm

Hi Loic,

Thank you very much. This looks fantastic. Just one question. I am a bit confused with the license numbers. In your example, you use "oLicenseManager.RegisterKEY"... but I received TWO keys, one for GdPicture Image and another for the Tesseract Add-On. What is the correct way to set my license?

Thanks,
Jacob

User avatar
Loïc
Site Admin
Posts: 5592
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by Loïc » Fri Nov 11, 2011 6:53 pm

Hi Jacob,

Just call the Register key for each of your license. No matter the order.

Ie:

oLicenseManager.RegisterKey(LIC1)
oLicenseManager.RegisterKey(LIC2)

Cheers!

Loïc

JacobRusso
Posts: 4
Joined: Wed Sep 14, 2011 7:47 pm

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by JacobRusso » Fri Nov 11, 2011 8:01 pm

Thank you again that works!
I did not purchase the PDF Add-On. When it tries the "oGdPicturePDF.MergeDocuments(files, fileDest)" I get a message that I'm not licensed for the PDF Add-On. What would be the cleanest way to do this without the Add-On?

User avatar
Loïc
Site Admin
Posts: 5592
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by Loïc » Sun Nov 13, 2011 5:52 pm

Hi Jacob,

unfortunately there is no other way than using the GdPicture PDF plugin to get this sample working. I am sorry, I forgot to specify that.

Kind regards,

Loîc

rens012
Posts: 6
Joined: Thu Jul 23, 2009 11:33 am

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by rens012 » Wed Feb 22, 2012 10:12 am

Hi,

Is there a way to create a pdf/a file with the oGdPicturePDF.MergeDocuments() method?


Thanks,

Rens

User avatar
Loïc
Site Admin
Posts: 5592
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by Loïc » Wed Feb 22, 2012 3:57 pm

Hello,

In the next minor release MergeDocuments() will generate PDF/A according to the input documents. I will upload soon a modified version of the Demo for demonstrating example of usage.

Kind regards,

Loïc

User avatar
Loïc
Site Admin
Posts: 5592
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by Loïc » Thu Feb 23, 2012 6:14 pm

Hello,

Please find attached the version that supports PDF/A as output. To be used with GdPicture.NET 8.5.15 and higher.



Kind regards,

Loïc
Attachments
Multi-thread TIFF to PDF-OCR PDFA.zip
Multithread TIFF 2 PDF/OCR with PDF/A support.
(18.84 KiB) Downloaded 293 times

JacobRusso
Posts: 4
Joined: Wed Sep 14, 2011 7:47 pm

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by JacobRusso » Thu Mar 08, 2012 1:33 am

Hi Loic,
When I exract and open this project, I am missing the "modGlobals.vb".
Also, in the previous version, "MultiPageOCRThreading.zip", I found that the pages were not being processed in the proper order. The problem was in the "cmdRun_Click" event. When storing the individual pages, the sort order for the files goes off track if there are more than 9 pages. For example;

page1.tif
page11.tif
page2.tif

I was able to correct this by modifying the "SaveAsTIFF" with "Format" statement as follows:

oGdPictureImaging.SaveAsTIFF(tiffID, tmp_path + "\page" + Format(i, "0000").ToString + ".tif", GdPicture.TiffCompression.TiffCompressionAUTO)

This way, they are sorted correctly as;
page0001.tif
page0002.tif
...
page0011.tif

Thanks,
Jacob

This way, the files are ordered as:

JacobRusso
Posts: 4
Joined: Wed Sep 14, 2011 7:47 pm

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by JacobRusso » Thu Mar 08, 2012 5:22 am

Loïc,

One more thing. Do you have any experience with the new .NET Framework 4 "System.Threading.Tasks" namespace or TaskFactory class? It seems to be very powerful, and hopefully, easier to implement?

Imports System.Threading
Imports System.Threading.Tasks

Dim taskA = _
Task.Factory.StartNew(Sub

... multithreaded statements ...

End Sub)

User avatar
Loïc
Site Admin
Posts: 5592
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by Loïc » Thu Mar 08, 2012 3:33 pm

Hello,

Please find attached the fixed version.

Kind regards,

Loïc
Attachments
mtocr.zip
Multithread TIFF 2 PDF/OCR with PDF/A support
(22.81 KiB) Downloaded 346 times

rom
Posts: 2
Joined: Tue Jun 26, 2012 5:24 pm

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by rom » Tue Jun 26, 2012 5:33 pm

Hi Loïc


I'm using de trial version in a delphi project


Can u provide tha same example in a delphi project?

tks

rom
Posts: 2
Joined: Tue Jun 26, 2012 5:24 pm

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by rom » Thu Jul 05, 2012 4:56 pm

Hi, can u provide the same example using delphi?

User avatar
Loïc
Site Admin
Posts: 5592
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by Loïc » Thu Jul 05, 2012 4:58 pm

Hello Rom,

Unfortunately we have no competence in multithreading under Delphi.

sulfaroj
Posts: 9
Joined: Tue Jun 19, 2012 5:50 am

Re: [Demo App] Multi-thread Tiff to PDF/OCR

Post by sulfaroj » Fri Nov 02, 2012 4:38 am

Hi,

Are there any updates to this demo app. I am looking at a way to OCR a PDF in a multithreaded or parallel processing way not a multipage TIFF. With .NET 4.0 is there any plan to handle OCR of a multipage document (PDF) in Parallel mode internally in the toolkit? Something like this would be a great feature.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest