Currently, I do not allow the user to select multiple pages in a TImageEnMView. However, I do allow them to export from page X to page Y. This process is very tine-consuming. A 70-page document takes 20 seconds. I can't find any more effective and efficient methods than these below. Here is my code:
procedure TForm1.ExportTiff(PageX, PageY: Integer; DestinationName: TFileName);
var
TIFFHandler: TIETIFFHandler;
PageIndex: Integer;
StreamedPage: TMemoryStream;
begin
TIFFHandler := TIETIFFHandler.Create();
try
for PageIndex := PageX to PageY do
begin
StreamedPage := TMemoryStream.Create();
try
iemvDocViewer.GetImageToStream( PageIndex, StreamedPage, ioTIFF );
StreamedPage.Position := 0;
TIFFHandler. InsertPageAsStream( StreamedPage, PageIndex );
finally
StreamedPage.Free;
end;
end;
TIFFHandler.WriteFile( DestinationName );
finally
TIFFHandler.Free;
end;
end;
As you can see, the image first has to be copied from memory in the component, to memory in a stream, and then from the stream to the TIFF file handler, and then from the file handler to disk. Can anyone offer anything faster? Again, I can't use any methods that include SelectedOnly as a parameter, because I only allow them to select one image.