Error on TwainAddGdPictureImageToPdfOCR

Discussions about machine vision support in GdPicture.
Post Reply
esseredigi
Posts: 3
Joined: Fri Jan 15, 2010 5:05 pm

Error on TwainAddGdPictureImageToPdfOCR

Post by esseredigi » Fri Jan 15, 2010 5:10 pm

Hi,
I'm a Delphi developer and I've tried to use Tesseract OCR but using method in subject I catch this error:
Object variable or with block variable not set

What's happened?

Thanks

--
Alfredo Silvano

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

Re: Error on TwainAddGdPictureImageToPdfOCR

Post by Loïc » Fri Jan 15, 2010 5:38 pm

Hi,

Please, check first you are using the latest edition.

If the problem persists, try to give us a way to reproduce your problem.

With best regards,

Loïc

esseredigi
Posts: 3
Joined: Fri Jan 15, 2010 5:05 pm

Re: Error on TwainAddGdPictureImageToPdfOCR

Post by esseredigi » Fri Jan 22, 2010 4:19 pm

Hi,
Loïc wrote:Hi,

Please, check first you are using the latest edition.

If the problem persists, try to give us a way to reproduce your problem.

With best regards,

Loïc
nothing to do, with last version, same result.
For reproduce this problem, you can put a TButton and a TMemo on your Delphi demo program with this source:

Code: Select all

procedure TForm1.btn1Click(Sender: TObject);
var
  imgH: Integer;
  DictPath: string;
begin
  InitScanConfig;
  if Twain1.TwainOpenDefaultSource then
  begin
    Twain1.TwainSetAutoFeed(True);
    Twain1.TwainSetAutoScan(True);
    Twain1.TwainSetCurrentResolution(400);
    Twain1.TwainSetCurrentPixelType(TWPT_GRAY);
    Twain1.TwainSetCurrentBitDepth(8);
    Twain1.TwainEnableDuplex(False);
    Twain1.TwainSetPaperSize(A4);
    Twain1.TwainPdfStart('C:\Users\MyUser\Desktop\ocr.pdf','','','','');
    DictPath := ExtractFilePath(ParamStr(0)) + 'ocrdata';
    While Twain1.TwainAcquireToGdPictureImage(Handle) <> 0 do
    Begin
       imgH := Twain1.GetNativeImage;
       ApplyImageFilters(imgH);
       If chkPreview.Checked Then DisplayNativeImage;
         Memo1.Text := Twain1.TwainAddGdPictureImageToPdfOCR(imgH,TesseractDictionaryItalian,
                                             DictPath,'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-/\()');
       Twain1.CloseImage(imgH);
    end;
    Twain1.TwainPdfStop;
    Twain1.TwainCloseSource;
  end;
end;
Thanks
--
Alfredo Silvano

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

Re: Error on TwainAddGdPictureImageToPdfOCR

Post by Loïc » Fri Jan 22, 2010 8:04 pm

Hi,

Please replace:

Code: Select all

TwainPdfStart
by:

Code: Select all

TwainPdfOCRStart
With best regards,

Loïc

esseredigi
Posts: 3
Joined: Fri Jan 15, 2010 5:05 pm

Re: Error on TwainAddGdPictureImageToPdfOCR

Post by esseredigi » Tue Jan 26, 2010 4:12 pm

Loïc wrote:Hi,

Please replace:

Code: Select all

TwainPdfStart
by:

Code: Select all

TwainPdfOCRStart
With best regards,

Loïc
Ok, now run correctly, but OCR doesn't check on dictionary, what else?
Thanks

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

Re: Error on TwainAddGdPictureImageToPdfOCR

Post by Loïc » Tue Jan 26, 2010 4:16 pm

Hi,

I don't understand your new issue. Could you give me more details ?

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest