How do I print in Delphi7 without Form Feed after Printer.EndDoc command

How can I prevent Printer.EndDoc from sending a FormFeed at the end of the print job?  I am getting a blank page on the tail end of my print Job.  
If it is not possible, is there a better way to print?  Here is a general reconstruction of the code snippet in question...
 
  ILDocumentImage1.P_Begin_End_Doc:=FALSE;
  Printer.Begindoc;
 
  for i:=0 to ILDocumentImage1.TiffPageCount-1 do
      Begin
          PrintThisPage:=PDocData(CurrentNode.Data)^.ddPageList[i].dpSelectedForPrint;
          if PrintThisPage then
             Begin
   
                //Send print job to printer
                ILDocumentImage1.PrintDOC(0,0, Printer.PageWidth,Printer.PageHeight);

                if i < (ILDocumentImage1.TiffPageCount-1) then   Printer.NewPage;
             end;
          ILDocumentImage1.Next;
        end;

  Printer.EndDoc;
cmcclennyAsked:
Who is Participating?
 
vb_jonasCommented:
Then I think you have a page that is larger than what can fit on one page.
0
 
vb_jonasCommented:
Change the Printer.NewPage, because in your code - if your last page wont print (You have to have the same condition), the last printed page will add a blank page.

You could do like this (add a TheFirstPage boolean)

  ILDocumentImage1.P_Begin_End_Doc:=FALSE;
  Printer.Begindoc;
 
  TheFirstPage := True;
  for i:=0 to ILDocumentImage1.TiffPageCount-1 do
      Begin
          PrintThisPage:=PDocData(CurrentNode.Data)^.ddPageList[i].dpSelectedForPrint;
          if PrintThisPage then
             Begin
   
                //Send print job to printer, a new page before every page but the first
                if Not TheFirstPage Then Printer.NewPage;
                TheFirstPage := False;
                ILDocumentImage1.PrintDOC(0,0, Printer.PageWidth,Printer.PageHeight);

             end;
          ILDocumentImage1.Next;
        end;

  Printer.EndDoc;

0
 
cmcclennyAuthor Commented:
vb_jonas...

I tried that and now only page 2, 3, and 2 blank pages print out.  
Before, it would print out page 1, 2, and 3 plus 1 blank page.

It's as if no matter what I try, Printer.EndDoc sends an extra Form Feed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.