Hmm, your code with the PDF above works fine for me:
procedure TfrmMain.Button3Click(Sender: TObject);
var
i: Integer;
B: TBitmap;
oPDF: TPdfObject;
FViewer: TImageEnView;
begin
OpenFile( 'D:\Testing_Multimedia\PDF\ColorTest.pdf' );
FViewer := ImageEnView1;
for i := 0 to FViewer.PdfViewer.Objects.Count - 1 do
begin
oPDF := FViewer.PdfViewer.Objects[i];
if (oPDF.ObjectType = ptImage) then
try
B := oPDF.GetImage;
try
// Result := EN_CleanupBitmap(B, AOpts);
oPDF.SetImage(B);
FViewer.PdfViewer.ReloadPage;
finally
B.Free;
end;
except
Raise;
end;
//break; //NOTE: We are only going to clean if One image on page.
end;
end;
As do both of the following:
// Reduce the size of the PDF file by lowering the quality of the images (B is a TIEBitmap)
for i := 0 to ImageEnView1.PdfViewer.Objects.Count - 1 do
begin
oPDF := ImageEnView1.PdfViewer.Objects[i];
if (oPDF.ObjectType = ptImage) then
begin
B := TIEBitmap.Create();
try
if oPDF.GetImage( B ) then
begin
B.Resample( 0.5 );
oPDF.SetImage(B);
end;
finally
B.Free;
end;
end;
end;
ImageEnView1.PdfViewer.ReloadPage();
// Same as above but B is a TBitmap (must add iexHelperFunctions to your uses clause for TBitmap.Proc)
for i := 0 to ImageEnView1.PdfViewer.Objects.Count - 1 do
begin
oPDF := ImageEnView1.PdfViewer.Objects[i];
if (oPDF.ObjectType = ptImage) then
begin
B := oPDF.GetImage();
if B <> nil then
try
B.Proc.Resample( 0.5 );
oPDF.SetImage(B);
finally
B.Free;
end;
end;
end;
ImageEnView1.PdfViewer.ReloadPage();
Are you using ImageEn v13.6.0?
Does it happen with all PDF files you test.
Can you check your version of the iepdf32.dll, by right-clicking it and selecting Properties? It should be v 125.0.6406.0.
Is there any further information you can provide?
Nigel
Xequte Software
www.imageen.com