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
 GenerateSearchablePDF creates very large PDF's for JPEG images

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
kevingmcb Posted - Apr 05 2024 : 15:58:50
I am using the GenerateSearchablePDF demo with IEVision 8.1.0 and when generating a PDF from two JPEG files (about 500K each) the resulting PDF is around 20meg (about 10 meg. per page). If I use the PDF Optimizer tool in Acrobat to apply JPEG compression to the images in the PDF (without downsampling) the file size is reduced by a factor of 20 approx., resulting in a PDF of around 1 meg.

I tried modifying the demo to add the JPEG image format parameter to the pdfGen.addPage call as follows:

pdfGen.addPage(ImageEnMView1.IEBitmap.GetIEVisionImage(),ievPDFImgFmt_JPEG);

However the resulting PDF is empty. Is there any way to apply JPEG compression to the images so that the resulting PDF is not so large?

Thanks.



Kevin McB
6   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Apr 16 2024 : 18:24:49
Hi Kevin

We're aiming for later in April.

Nigel
Xequte Software
www.imageen.com
kevingmcb Posted - Apr 16 2024 : 15:21:57
Thanks Nigel! Any time frame for the next update?

Kevin McB
xequte Posted - Apr 15 2024 : 23:01:17
Hi Kevin

We'll a fix for the JPEG output issue in the upcoming release.

Nigel
Xequte Software
www.imageen.com
xequte Posted - Apr 06 2024 : 18:28:24
Sorry Kevin,

I misread your original message

I thought you were using the native PDF generator (http://www.imageen.com/help/TIEPDFBuilder.html), but as you actually stated you are using IEVision's GenerateSearchablePDF method.

In that case, TIOParams.PDF_Compression is not relevant, and ievPDFImgFmt_JPEG is the correct method to output with JPEG compression, rather than the default FLATE.

In testing the code, I can confirm that there is something unexpected happening when ievPDFImgFmt_JPEG is specified, so I've passed that onto my partner to investigate.


Nigel
Xequte Software
www.imageen.com
kevingmcb Posted - Apr 06 2024 : 12:15:04
Hi Nigel,

I am using ImageEn 13.1.0 and IEVision 8.1.0 with Delphi 12 Athens.

I modified the GenerateSearchablePDF demo to apply the JPG compression and remove any alpha channel, as follows, but the resulting PDF is still about 10 meg. per page:


// generate PDF
    pdfGen := IEVisionLib.createSearchablePDFGenerator(PAnsiChar(AnsiString(langPath)), PAnsiChar(AnsiString(langCode)) );
    pdfGen.setSegmentationMode(TIEVisionOCRPageSegmentationMode(cmbLayout.ItemIndex));
    pdfGen.beginDocument(PAnsiChar(AnsiString( outFile )), PAnsiChar(AnsiString( 'IEVision PDF Test' )));
    for i := 0 to ImageEnMView1.ImageCount - 1 do
    begin
      ProgressBar1.Position := MulDiv( i, 100, ImageEnMView1.ImageCount );
      ProgressBar1.Visible  := True;

      ImageEnMView1.SelectedImage := i;
      Application.ProcessMessages();
      ImageEnMView1.IEBitmap.ParamsEnabled := true;
      ImageEnMView1.IEBitmap.Params.Dpi := ImageEnMView1.MIO.Params[i].Dpi;
      // added to set compression and remove alpha channel from JPEG images
      if ( CompareText( ExtractFileExt( ImageEnMView1.MIO.Params[i].FileName ), '.jpg' ) = 0 ) 
      or ( CompareText( ExtractFileExt( ImageEnMView1.MIO.Params[i].FileName ), '.jpeg' ) = 0 ) then
      begin
        ImageEnMView1.IEBitmap.Params.PDF_Compression := ioPDF_JPEG;
        ImageEnMView1.IEBitmap.Params.JPEG_Quality    := 90;
        if ImageEnMView1.IEBitmap.HasAlphaChannel() then
          ImageEnMView1.IEBitmap.RemoveAlphaChannel( true );
        ImageEnMView1.Update;
      end;
      //
      pdfGen.addPage(ImageEnMView1.IEBitmap.GetIEVisionImage());
    end;
    pdfGen.endDocument();
    pdfGen := nil;


Is there something I'm missing?

Thanks



Kevin McB
xequte Posted - Apr 05 2024 : 16:13:31
Hi Kevin

Firstly, can you confirm what version of ImageEn you are using. Prior to v13, ImageEn did not explicitly check whether images had a transparency. If you enabled the alpha channel, even if it was not used, it made the PDF much larger because the images needed to be output with the alpha channel (which is not JPEG compressed).

Secondly, please specify the PDF image compression as JPEG using:

http://www.imageen.com/help/TIOParams.PDF_Compression.html


Nigel
Xequte Software
www.imageen.com