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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 The generated PDF file is very large
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Flashcqxg

93 Posts

Posted - Sep 23 2021 :  22:04:14  Show Profile  Reply
Hi
I tested it with the following code and found that the generated pdf document is very large, about 8M, but the total of 1.jpeg and 2.jpeg is only about 200kb.
I did not use PDF_Compression for compression, because it will slow down the speed of PDF generation. Is there a better way to increase the speed of PDF generation while being able to use relatively small generated documents.

var
  IO: TImageEnIO;
begin
  IO := TImageEnIO.Create(NIL);
  IO.CreatePDFFile('test.pdf');
  try

    IO.LoadFromFile('1.jpeg');
    IO.Params.PDF_PaperSize := iepA3;
    //IO.Params.PDF_Compression := ioPDF_JPEG;
    IO.SaveToPDF;

    IO.LoadFromFile('2.jpeg');
    IO.Params.PDF_PaperSize := iepA3;
    //IO.Params.PDF_Compression := ioPDF_JPEG;
    IO.SaveToPDF;
  finally
    IO.ClosePDFFile;
    IO.Free;
  end;
end;

xequte

38209 Posts

Posted - Sep 24 2021 :  01:57:39  Show Profile  Reply
Hi

The default compression is ioPDF_G4FAX, which is not compatible with color images, so defaults to ioPDF_UNCOMPRESSED. You should specify ioPDF_LZW or ioPDF_JPEG.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Flashcqxg

93 Posts

Posted - Sep 24 2021 :  02:13:29  Show Profile  Reply
Hi,
I used the ioPDF_LZW or ioPDF_JPEG,but they are slowly,how to faster?
Go to Top of Page

xequte

38209 Posts

Posted - Sep 25 2021 :  00:50:06  Show Profile  Reply
Hi

Compressing images is slower than direct saving. Are your images very large? Perhaps you could resample (resize them smaller) before saving?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Flashcqxg

93 Posts

Posted - Sep 25 2021 :  04:04:13  Show Profile  Reply
The total of 1.jpeg and 2.jpeg is only about 200kb.
Go to Top of Page

xequte

38209 Posts

Posted - Sep 26 2021 :  01:50:29  Show Profile  Reply
I just timed this. It took 1/10th of a second to create the PDF with ioPDF_JPEG, and 1/20th a second with ioPDF_UNCOMPRESSED. That speed seems reasonable.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Flashcqxg

93 Posts

Posted - Sep 26 2021 :  03:34:40  Show Profile  Reply
My test: 36 pictures, each picture size does not exceed 150kb, compressed using ioPDF_JPEG, respectively generated 6 different pdf documents, a total of 8 seconds.
I currently have about 300,000 pictures and need to generate about 50,000 pdf documents. Do you have any good suggestions?
Go to Top of Page

xequte

38209 Posts

Posted - Sep 26 2021 :  17:27:44  Show Profile  Reply
Sorry, I don't see any way to optimize that.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Flashcqxg

93 Posts

Posted - Sep 26 2021 :  19:30:08  Show Profile  Reply
Thanks.
Go to Top of Page

costasd

Cyprus
1 Posts

Posted - Oct 04 2021 :  03:24:40  Show Profile  Reply
Perhaps you should try to use multiple threads? This will definitely make it work faster.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: