Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

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;
0
cmcclenny
Asked:
cmcclenny
  • 2
1 Solution
 
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
 
vb_jonasCommented:
Then I think you have a page that is larger than what can fit on one page.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now