ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Save the with OCR recognized text back to the PDF

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
harry stahl Posted - Feb 10 2023 : 05:10:30
The demo "OCRWithLayout" (IEVision) shows how to regcognize the text from a PDF (load in to ImageneView1), that contains the text as image. It draws the recognized text by adding a new textlawer then on the ImageEnview2.

My Question: I would like to save the extracted text into the original PDF behind the image, so that the pdf becomes searchable.

Alternatively it would also be OK to create a new PDF and saving image and text in the described order.

Is that possible with ImageEn, and if yes, how?

If I save the ImageEnview2 as a pdf (imageenview2.io.SaveToFilePDF('D:\ANewOne.pdf')), then all the text is on a small area on the left side (0,5 cm width and pageheigt).

HS
8   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 22 2023 : 21:00:55
Hi Harry

TIEVisionSearchablePDFGenerator is an external feature, it makes no use of IOParams.PDF_PaperSize.

You must specify the size of document by setting the size of the source bitmap, or specifying a DPI as follows:

ImageEnMView1.IEBitmap.ParamsEnabled := true;
ImageEnMView1.IEBitmap.Params.Dpi := DPI_VALUE;
pdfGen.addPage(ImageEnMView1.IEBitmap.GetIEVisionImage());


Nigel
Xequte Software
www.imageen.com
harry stahl Posted - Feb 22 2023 : 16:54:34
OK, I have solved it insofar, as I create always an 100 DPI Pixel Image (Size 827x1169) and stretchdraw all input (via scanner or open file) to that size. Then I set "ImageEnMView1.IEBitmap.Params.Dpi" always to 100 DPI and then all resulting pages have the A4 size.

HS
harry stahl Posted - Feb 22 2023 : 09:54:19
It is important for me, that also the way over the file-loading works. Because my program is a 64-Bit Program, I can not use your Aquire-function. I have a 32-Bridgeprogram, that aquires the image, that is saved to jpg or png. This file I load into the ImageEnMView. But resulting pdf has no A4-Size.

HS
harry stahl Posted - Feb 22 2023 : 09:25:11
I used your demo (Generate Searchable PDF):

// File -> Open
procedure TF_ScannPDF.Open1Click(Sender: TObject);
var
  filename: string;
begin
  filename := ImageEnMView1.MIO.ExecuteOpenDialog();
  if filename <> '' then
    ImageEnMView1.MIO.LoadFromFile(filename);
end;

And than I add it here:

  for i := 0 to ImageEnMView1.ImageCount - 1 do
    begin
      ImageEnMView1.SelectedImage := i;
      Application.ProcessMessages();
      ImageEnMView1.IEBitmap.ParamsEnabled := true;
      ImageEnMView1.IEBitmap.Params.PDF_PaperSize   := iepA4; // This added here, has no effect
      ImageEnMView1.IEBitmap.Params.Dpi := ImageEnMView1.MIO.Params[i].Dpi;
      pdfGen.addPage(ImageEnMView1.IEBitmap.GetIEVisionImage());
    end;


HS
xequte Posted - Feb 21 2023 : 23:05:47
Hi Harry

Can you show me your code? This worked fine for me:

  ImageEnView1.IO.LoadFromFile( 'd:\827x1170.gif' );
  ImageEnView1.IO.Params.PDF_PaperSize := iepA4;
  ImageEnView1.IO.SaveToFile( 'd:\827x1170.pdf' );


Nigel
Xequte Software
www.imageen.com
harry stahl Posted - Feb 20 2023 : 12:22:30
It works in principle. But the resulting pdf page is too small. As Input-file I have an Image with size 827x1170 pixels. But the resulting pdf has only size of 7x9 cm (instead of 21x29 cm).

How can I change this, so that I get a pdf-page with normal A4-Size?

Tying to add

ImageEnMView1.IEBitmap.Params.PDF_PaperSize := iepA4;

has no effect.

If I use "Aquire" then the resulting PDF will be OK, but not by open an image-file.

HS
harry stahl Posted - Feb 20 2023 : 12:08:40
Thank you, perfect, I will test it.

HS
xequte Posted - Feb 11 2023 : 14:13:17
Hi

ImageEn cannot modify the page content of an existing PDF. It can create pages and/or PDF files, and add or remove whole pages, but not edit the page content.

But in this case it sounds like you are attempting to an existing function: Convert an image into a searchable PDF file.

Please see:

https://www.imageen.com/help/TIEVisionSearchablePDFGenerator.html

Nigel
Xequte Software
www.imageen.com