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
 Out of memory error when printing a tiff with 600dpi images
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

pchoiniere

USA
6 Posts

Posted - Aug 09 2021 :  11:08:45  Show Profile  Reply
I'm using ImageEn 9.2.0. I've tried to attach the tiff (27MB), but keep getting the following error:

Request object error 'ASP 0104 : 80004005'

Operation not Allowed

/ieforum/outputFile.asp, line 71

Here is the code I'm using.



procedure TForm1.Button1Click(Sender: TObject);
begin
  var mv := TImageEnMView.Create(nil);
  try
    mv.MIO.LoadFromFileTIFF('..\..\memo.tiff');
    PrintTIFFPages(mv);
  finally
    mv.Free;
  end;
end;

function TForm1.PrintTIFFPages(ATifObject: TImageEnMView;
  AAutoRotate: Boolean = True; AStartPage: integer = 0; AEndPage: integer = -1): Boolean;
var
  l_index: integer;
  FirstPage: Boolean;
begin
  Result := True;
  FirstPage := True;
  if ATifObject.ImageCount = 0 then
    Exit;

  if (AEndPage = -1) or (AEndPage > ATifObject.ImageCount-1) then
    AEndPage := ATifObject.ImageCount-1;

  Printer.Title := 'Docman';

  // If Printing to a file (i.e. PDF) the request for a file name occurs here.
  Printer.BeginDoc;
  try
    // User canceled printing (This happens when printing to PDF and user cancels when requesting a file name)
    if not Printer.Printing then
    begin
      Result := False;
      Exit;
    end;

    for l_index := AStartPage to AEndPage  do
    begin
      // Check incase user aborted print job
      if not Printer.Printing then
      begin
        Result := False;
        Exit;
      end;

      // -----------------------------------------------------------------------------------
      // There was code here to modify the image that I've removed to simplify the example.
      // -----------------------------------------------------------------------------------

      if not FirstPage then
        Printer.NewPage;
      FirstPage := False;
      ATifObject.MIO.PrintImage(l_index, nil,0,0,0,0);
    end;
  finally
    if Printer.Printing then
      Printer.EndDoc;
  end;
end;

xequte

38796 Posts

Posted - Aug 09 2021 :  17:39:22  Show Profile  Reply
Hi

Yes, 27MB will be too big for the forum.

Can you use a file sharing service and email me a link to the file?





Nigel
Xequte Software
www.imageen.com
Go to Top of Page

pchoiniere

USA
6 Posts

Posted - Aug 10 2021 :  11:18:55  Show Profile  Reply
Our company deals with health info and has locked down the network so tight that it took a while to figure how to get this file to you.

Link to zip file with source and TIFF
https://1drv.ms/u/s!AhvoRZKnwMWmj3azV3N3TiVroVty?e=edwyMO
Go to Top of Page

xequte

38796 Posts

Posted - Aug 10 2021 :  18:05:35  Show Profile  Reply
Hi

Try loading each page as it is printed:

// Print all frames of a multi-page TIFF
procedure PrintAllPages(const Filename: string);
Var
  bmp: TIEBitmap;
  io: TImageEnIO;
  i: Integer;
Begin
  bmp := TIEBitmap.Create();
  io  := TImageEnIO.CreateFromBitmap(bmp);
  try
    io.LoadFromFile( Filename  );

    Printer.Title := 'TIFF Pages';
    Printer.BeginDoc;
    for i := 0 to io.Params.ImageCount - 1 do
    begin
      io.Params.ImageIndex := i;
      if i > 0 then
        io.LoadFromFile( Filename );
      io.PrintImage();
    end;
    Printer.EndDoc;

  finally
    io.Free;
    bmp.Free;
  end;
End;


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