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
 TBitmap to PDF File
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jeffp

USA
74 Posts

Posted - Aug 02 2026 :  09:34:00  Show Profile  Reply
I'm trying to quickly turn a TBitmap into a PDF file with the code below.

However, the resulting PDF file contains my bitmap BUT IT'S BLANK. What am I missing here?


function EN_BitmapToPDFFile2(ABitmap: TBitmap; AFileName: String; const AInchesW: Double = cLetterWidth; const AInchesH: Double = cLetterHeight): String;
var
  B: TIEBitmap;
begin
  B := TIEBitmap.Create;
  try
    B.CopyFromTBitmap(ABitmap, TRUE);
    B.IO.CreatePDFFile(AFileName);
    B.IO.Params.PDF_PaperWidth := Ceil(I2P(AInchesW));
    B.IO.Params.PDF_PaperHeight := Ceil(I2P(AInchesH));
    B.IO.Params.PDF_ImageOptions := [iepioShrinkOnly, iepioCentered];
    B.IO.Params.JPEG_Quality := 75;
    B.IO.Params.PDF_Compression := ioPDF_JPEG;

    B.IO.SaveToPDF;
    B.IO.ClosePDFFile;
  finally
    B.Free;
  end;
end;


jp

xequte

39510 Posts

Posted - Aug 03 2026 :  00:34:07  Show Profile  Reply
Hi Jeff

Your code works fine for me (with and without iepdf32.dll). What is the ABitmap.PixelFormat? It should be a valid format, like pf24bit, not pfDevice.

Try saving B (or using our debugging visualizer) to ensure it is valid after B.CopyFromTBitmap().

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