0

When I print a document from my Delphi 2007 program I quite often get a message "Printing in progress " and printing is aborted. Only part of the page is printed,not always identical part,but close.
When closing the message I get "Access violation at address 004FEEC5 in module........read of address 00000008."
I then have to exit and restart the program to start a new print session, or I will get the same message.

I can't see a pattern, but have got an impression that it has something to do with how busy the computer is.

Any ideas how to control this problem?

Edited by AKJo

5
Contributors
17
Replies
20
Views
4 Years
Discussion Span
Last Post by AKJo
0

I'm soon getting desperate.
I have tried and tried and tried to answer the response I got on my article, but every time I try, and click "Reply to this Article" it seems like I'm logged out and I'm adviced to be a member, despite I'm logged in already.
What is wrong?? Noone to get advice from either.
Now I had to register as a new member to magage to give this response.

Reply to pritaeas:

Yes,
I have tried with different PDF printers on different computers, Vista and Win 7.

0

Can you share part of your code. If it fails on all, it has to be a coding issue.

As for the logging in, does it happen with every browser? You can consider posting a report in the Community Feedback forum.

Edited by pritaeas: Addon

0
  Printer.Orientation := poPortrait;
  Printer.Title := txt + ' SS' + FrmNotes.EdStageNo.text + ' Page ' + pagesToPrint;
  if Form1.ActivateDelayAtPrintout.Checked then
  begin
    showmessage('Delay 1');  //Pause to avoid "Printing in progress" error
    Form1.LblWAIT.update;
  end;
  printer.beginDoc;
  if Form1.ActivateDelayAtPrintout.Checked then
  begin
    showmessage('Delay 2');  // Pause to avoid "Printing in progress" error
                             // Not sure if this second delay is needed
    Form1.LblWAIT.update;
  end;

I have put in those delays, because if I wait for some seconds it works.
If I just loop for some seconds I get the error.
It has never happened when I run RAD Studio, only with compiled programs.

0

My title is not empty.
The problem doesn't happen every time. If I repeat printing, or choose a different PDF printer it may work sometimes.

0

It has never happened when I run RAD Studio, only with compiled programs.

I missed this. Does it make a difference whether it is a Debug or Release build ?

0

No difference.
Hope my images of my error messages are attached now.

btw: I'm using Firefox now to avoid being logged out.

Attachments DaniWeb1.jpg 6.54 KB DaniWeb2.jpg 13.34 KB
0

But it never happens when I run it from RAD Studio

0

When it happen it seems to happen on the "RoundRect" below as "PrintHeadOfPage 1.5" is shown on screen, and I get the rectangle drawn on my PDF document.
However I think I have got the error in at least one other position some time, with more of the printout done.
Where can I find out what "Printing in progress" actually means?

Form1.LblWAIT.Caption := 'PrintHeadOfPage 1.5';
Form1.LblWAIT.update;
  printer.canvas.RoundRect(posX('Left border', printer.pagewidth)
                       , posY('Top border', printer.PageHeight, pageNo)
                       , posX('Right border', printer.pagewidth)
                       , posY('Head bottom border', printer.PageHeight, pageNo)
                       , i, i);
Form1.LblWAIT.Caption := 'PrintHeadOfPage 2';
Attachments DaniWeb3.jpg 18.26 KB DaniWeb4.jpg 18.31 KB
0

Can you add exception handling around the printing, perhaps there's a hidden crash somewhere that triggers that message.

0

When it happen it seems to happen on the "RoundRect" below as "PrintHeadOfPage 1.5" is shown on screen, and I get the rectangle drawn on my PDF document.
However I think I have got the error in at least one other position some time, with more of the printout done.
Where can I find out what "Printing in progress" actually means?

Form1.LblWAIT.Caption := 'PrintHeadOfPage 1.5';
Form1.LblWAIT.update;
  printer.canvas.RoundRect(posX('Left border', printer.pagewidth)
                       , posY('Top border', printer.PageHeight, pageNo)
                       , posX('Right border', printer.pagewidth)
                       , posY('Head bottom border', printer.PageHeight, pageNo)
                       , i, i);
Form1.LblWAIT.Caption := 'PrintHeadOfPage 2';
0

With try - except I have located the problem to my next RoundRect sentence. Is there a way to get deeper info about the error?

Form1.LblWAIT.Caption := 'PrintHeadOfPage 2';
try

   printer.canvas.RoundRect(posX('Left border', printer.pagewidth)
                       , posY('Notes top border', printer.PageHeight, pageNo)
                       , posX('Right border', printer.pagewidth)
                       , posY('Bottom border', printer.PageHeight, pageNo)
                       , i, i);
except
  showmessage('Error at printing border ');
end;
0
Form1.LblWAIT.Caption := 'PrintHeadOfPage 2';
try
  printer.canvas.RoundRect(posX('Left border', printer.pagewidth)
                   , posY('Notes top border', printer.PageHeight, pageNo)
                   , posX('Right border', printer.pagewidth)
                   , posY('Bottom border', printer.PageHeight, pageNo)
                   , i, i);
except
  on E: Exception do
    ShowMessage(E.Message);
end;
0

You are a star!
However I can't find a way to convert the given addresses 00520D35 and 00000008 to my source code. I think I have searched everywhere, but probably not.

Attachments DaniWeb6.jpg 8.94 KB
0

You can try to check if the printer, or any of the properties are unavailable. Or perhaps it is in the PosX or PosY functions.

0

I'm suspecting something is reentrant. Will search along that path....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.