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
 Saving to PDF larger in v8?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

xequte

38613 Posts

Posted - Jul 22 2019 :  21:47:56  Show Profile  Reply
If you are seeing larger PDF files created in v8 than your v7 code, then ensure that your source images do not contain an alpha channel.

Support for Alpha channels in PDF was added in v8 and this will enlarge PDF documents.

Example code from user:

procedure TForm1.Button1Click(Sender: TObject);
var
  MyImage : TImageEnView;
  FileName : string;
  Is24RGB : boolean;
  I: Integer;
begin
  FileName := 'D:\Save.PDF';

  if FileExists(FileName) then
    DeleteFile(PChar(FileName));

  MyImage := TImageEnView.Create(nil);
  MyImage.LegacyBitmap := False;
  try
    MyImage.IO.CreatePDFFile(FileName);
    try
      for I := 0 to Listbox1.Items.Count - 1 do
      begin
        MyImage.IO.LoadFromFileTIFF(Listbox1.Items[i]);

        MyImage.IO.Params.PDF_PaperWidth  := MyImage.IEBitmap.Width;
        MyImage.IO.Params.PDF_PaperHeight := MyImage.IEBitmap.Height;

        if chkForceMono.checked then
        begin
          MyImage.Proc.ConvertToBWThreshold(-1);
          MyImage.RemoveAlphaChannel();
        end;

        Is24RGB := MyImage.IEBitmap.PixelFormat = ie24RGB;

        if Is24RGB then
          MyImage.IO.Params.PDF_Compression := ioPDF_JPEG
        else
          MyImage.IO.Params.PDF_Compression := ioPDF_G4FAX;

        MyImage.IO.SaveToPDF;
      end;

    finally
      MyImage.IO.ClosePDFFile;
    end;
  finally
    MyImage.Free;
  end;
end;


Nigel
Xequte Software
www.imageen.com
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: