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
 How to merge multiple jpg pictures to generate a pdf file without visual control
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Flashcqxg

93 Posts

Posted - Sep 16 2021 :  21:20:59  Show Profile  Reply
I have multiple single picture files in jpg format, and I want to merge these pictures into one pdf file. Moreover, it is required that the first page of the pdf file is a newly added picture with the text ‘Hello word!’ written on the picture. How can I do it? thanks.

xequte

38128 Posts

Posted - Sep 17 2021 :  02:15:34  Show Profile  Reply
Hi

Please try the demo:

\demos\InputOutput\PDFBuilder\PdfBuilder.dpr

Or compiled at:

https://www.imageen.com/files/demos/run/InputOutput/PDFBuilder/PdfBuilder.exe

It shows how to create a PDF from multiple images.

To create the image with text use:

https://www.imageen.com/help/TImageEnProc.TextOut.html

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

Flashcqxg

93 Posts

Posted - Sep 17 2021 :  04:03:43  Show Profile  Reply
Hi
I tested it with the following code and found that the generated pdf document is relatively large, about 8M, but the total of 1.jpeg and 2.jpeg is only about 200kb.

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

    IO.LoadFromFile('1.jpeg');
    Proce.TextOut(100, 100, 'adsfasdfasdfa');
    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;
    Proce.TextOut(100, 100, 'adsfasdfasdfa');
    IO.SaveToPDF;
  finally
    IO.ClosePDFFile;
    IO.Free;
    Proce.Free;
  end;
end;
Go to Top of Page

xequte

38128 Posts

Posted - Sep 21 2021 :  00:40:39  Show Profile  Reply
Hi

The TextOut method is adding an alpha channel to the image, which needs to be saved to the PDF. Because you don't use the alpha channel you should call:

IO.IEBitmap.RemoveAlphaChannel();

After TextOut. We'll handle this automatically for the next update.

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

Flashcqxg

93 Posts

Posted - Sep 23 2021 :  03:14:32  Show Profile  Reply
Thanks.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: