Solved

Printer Canvas Question

Posted on 1998-10-10
5
250 Views
Last Modified: 2010-04-06
I'm printing a form several times, running a loop and a procedure that uses the printer.begindoc and printer.enddoc method. I paint on the canvas using the textout procedure.

Here is my question: what is the most efficient way of clearing the canvas in between pages? Attempting to free and recreate the canvas causes an access error.

Here's a code chunk: the procedure writes sundry things to the canvas:

   if PrintDialog1.Execute then
      with printer do
         for i := 0 to 1 do begin
            main.caption := 'Printing ' + datetostr(tempdate + i);
            BeginDoc;
            canvas.font.size := 12;
            fillshift(tempdate + i,week,1 + i);
            EndDoc;
         end;
0
Comment
Question by:oneeye
  • 3
  • 2
5 Comments
 

Author Comment

by:oneeye
ID: 1342438
Edited text of question
0
 
LVL 4

Expert Comment

by:dwwang
ID: 1342439
Have you every tried not to "clear" the canvas?

As I understand, you needn't clear the canvas,
since when you begindoc, the printer canvas is a new one,
which is OK to draw for the next page you want to print.
0
 

Author Comment

by:oneeye
ID: 1342440
My second and subsequent pages appear to be overlayed on top of the first, so I can but assume that something is not clearing it.
0
 

Author Comment

by:oneeye
ID: 1342441
Argh.

I'm such an idiot. What appears to be one canvas overwriting the other was the font style.. fsUnderLined which I left turned on.

Since you were correct, resubmit and I'll approve the point transfer.
0
 
LVL 4

Accepted Solution

by:
dwwang earned 50 total points
ID: 1342442
Ok, good luck.

I sometimes make such kind of mistakes also.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question