• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

Printer Canvas Question

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
oneeye
Asked:
oneeye
  • 3
  • 2
1 Solution
 
oneeyeAuthor Commented:
Edited text of question
0
 
dwwangCommented:
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
 
oneeyeAuthor Commented:
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
 
oneeyeAuthor Commented:
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
 
dwwangCommented:
Ok, good luck.

I sometimes make such kind of mistakes also.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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