Hello,
I am trying to put jpgs into a PDF file.
I have tried many diffrent options. With or without PDFium.
PDFium always give me a exception that I can not monitor, so I came up with :
IEVx := tImageEnView.Create(JvXPContainer8);
IEVx.IO.CreatePDFFile(OutputFileName);
for p:=0 to TheList.Count-1 do
begin
IEVx.IO.Params.PDF_PaperSize := iepA4;
IEVx.IO.Params.Dpi := 90;
IEVx.IO.params.PDF_ImageOptions := [iepioShrinkOnly, iepioCentered];
IEVx.IO.Params.PDF_Compression := ioPDF_JPEG ;
IEVx.IO.Params.BitsPerSample := 2;
IEVx.IO.Params.SamplesPerPixel := 3;
IEVx.IO.LoadFromFile(TheList[p]);
if IEVx.IEBitmap_Width > IEVx.IEBitmap_Height then
IEVx.IO.Params.PDF_PaperLayout := ielLandscape
else
IEVx.IO.Params.PDF_PaperLayout := ielPortrait;
IEVx.Update();
IEVx.IO.SaveToPDF;
end;
IEVx.IO.ClosePDFFile;
IEVx.Free;
TheList containg full path to jpegs.
As a result I get an enormous PDF file (24 Mb for 13 pages).
All the page in it are close to the letter format 8,26 x 11,69 inches.
My jpegs are A4 digitized page 600 dpi, 4959 x 7031 pixels.
Some are in protrait some in landscape that why I am turning some.
If I don't I get a big page with a white bottom.
What am I missing and why the pages, thus the size of the PDF, is not shrunk to A4 ?
Many thanks in advance.
//------------------------------------------
Other tried way #1 :
IECreatePDFFromFileList(OutputFileName, TheList, iepA4 , ioPDF_JPEG , 'CHECKS_NUMBER', NOMUSER);
Using the same list as above.
Fires an exception everytime wheter I use PDFium or not.
//------------------------------------------
Other tried way #2 :
IevS := IEVisionLib.createSearchablePDFGenerator(PAnsiChar(AnsiString(langPath)), PAnsiChar(AnsiString(langCode)) );
IevS.beginDocument( PWideChar( OutputFileName ), PAnsiChar(AnsiString(RvRenderPDF1.DocInfo.KeyWords )));
Iev := TImageEnMView.Create(self);
udm1.fi_img.first;
while not udm1.fi_img.eof do
begin
if fileexists(udm1.fi_img.fieldbyname('CHEMIN_CPL').AsString) then
begin
Iev.MIO.LoadFromFileAuto(udm1.fi_img.fieldbyname('CHEMIN_CPL').AsString);
Application.ProcessMessages;
IEBitmap := Iev.IEBitmap.GetIEVisionImage();
IevS.addPage(IEBitmap, ievPDFImgFmt_JPEG) ;
Iev.clear;
end;
udm1.fi_img.next;
end;
IevS.endDocument();
//------------------------------------------ >
Same size of pages but 10 times longer because of the OCR.