I apologize for the delay. The following code works:
procedure TForm1.Button1Click(Sender: TObject);
var t:TgtPDFDocument; b:tbitmap; ima:TImageEnIO;
begin t:=TgtPDFDocument.Create(nil);
ima:=TImageEnIO.Create(nil); try
if not t.LoadFromFile('c:\temp\6thNL Final.pdf') then exit;
b:=t.GetBitmap(1,200,200);
b.PixelFormat:=pf24bit;
ima.IEBitmap.Assign(b); ima.Params.PNG_Filter:=ioPNG_FILTER_ALL;
ima.SaveToFilePNG('c:\temp\test.png'); finally ima.free; b.Free; t.Free; end;
end;
BUT the following DOES NOT work and gives similar image like the attached in the first post:
procedure TForm1.Button1Click(Sender: TObject);
var t:TgtPDFDocument; b:tbitmap; ima:TImageEnIO;
begin t:=TgtPDFDocument.Create(nil);
ima:=TImageEnIO.Create(nil); try
if not t.LoadFromFile('c:\temp\6thNL Final.pdf') then exit;
b:=t.GetBitmap(1,200,200);
b.PixelFormat:=pf24bit;
b.PixelFormat:=pf32bit;
ima.IEBitmap.Assign(b); ima.Params.PNG_Filter:=ioPNG_FILTER_ALL;
ima.SaveToFilePNG('c:\temp\test.png'); finally ima.free; b.Free; t.Free; end;
end;
I am using Delphi 10.1 Berlin