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
 MIO.Savetopdf

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
tchant Posted - May 06 2015 : 03:08:13
Hi ALl,

I'm a little new to this but any help would be appreciated , I'm using Delphi 2009 and ImageEn Ver 6.0.0, The bit of code below take an input *.tif file ( multi page in most cases and All I want to do is save it to a pdf file ,the pdf ends up being huge so the compression is cleary not being applied. where have I gone wrong in this. Appreciate any help guys / girls.

function TForm3.fCreatePDFFile(fInFile,fOutFile: String): boolean;
const
  PDFCompression: array[0..3] of TIOPDFCompression = (ioPDF_RLE, ioPDF_G3FAX2D, ioPDF_G4FAX, ioPDF_JPEG);

var iPageNum : Integer;
    StreamedDoc : TMemoryStream;
begin

  StreamedDoc := TMemoryStream.Create;
  ScanImg.Clear;
  ScanImg.MIO.LoadFromFileTIFF(fInFile) ;
  try
    for iPageNum := 0 to ScanImg.ImageCount - 1 do
    begin
      ScanImg.MIO.Params[iPageNum].PDF_Creator     := 'Company X';
      ScanImg.MIO.Params[iPageNum].PDF_PaperSize   :=  IEStrToPaperSize('A4', iepA4);
      ScanImg.MIO.Params[iPageNum].PDF_Compression := PDFCompression[0];
    end;
    ScanImg.MIO.SaveToStreamPDF(StreamedDoc);
    StreamedDoc.Position := 0;
    StreamedDoc.SaveToFile(fOutFile);
  finally
   StreamedDoc.Free;
   ScanImg.Clear;
  end;
end;



Trevor Chant
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - May 07 2015 : 19:26:48
Hi Trevor

How large are the images you are adding to the PDF? You might want to resample them to the page size, e.g.

...
  ScanImg.LockUpdate;
  for iPageNum := 0 to ScanImg.ImageCount - 1 do
  begin
    ScanImg.MIO.Params[iPageNum].PDF_Creator     := 'Company X';
    ScanImg.MIO.Params[iPageNum].PDF_PaperSize   :=  IEStrToPaperSize('A4', iepA4);
    ScanImg.MIO.Params[iPageNum].PDF_Compression := PDFCompression[0];
    ScanImg.SelectedImage := iPageNum;
    ScanImg.Proc.Resample(ScanImg.MIO.Params[iPageNum].PDF_PaperWidth, 
                          ScanImg.MIO.Params[iPageNum].PDF_PaperHeight,
                          rfLanczos3, True);
  end;
  ScanImg.UnlockUpdate;
...


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com