C# Printing: Is it possible to update on already printed page ?

  • Thread starter Thread starter Kristijan Marin
  • Start date Start date
K

Kristijan Marin

Hi,

I need to print a report like document. So in report there are many articles
and what I need when I get to the end, is to update page numbers on the
second page where the Table of Content is .... or even update strings like
Page 1 or 10 ... Page 2 of 10 etc ....

When starting the report I don't know the total number of pages nor the page
number on which each and every article starts ....

Is it at all possible to make an update later on ? What I do now is to go
through the document twice ... .in first loop I collect the page numbers, so
I can update it later in the second run .....

If i could leave one page blank and update it later would also do the trick
if I can do this at all !?

Thanks.

Kris
 
Kristijan,

Are you using the PrintDocument class to print your document? If so,
then you will have to use whatever calculations you would normally to
determine page size and whatnot, and predetermine the number of pages before
you do your printing. You can not go back and print on a page that has
already been printed, since most printers have no access to the printed page
once you have finished printing it (it's usually sitting in a tray).
 
Hi Nicholas,

Yes I'm using PrintDocument and yes I was affraid of that answer.....:)

Is there any other possible way to do this, cause the report can have from
5-50 or more pages and because pages contain images and text doing
calculation twice takes "time" .... no matter that I do my first calculation
offscreen and off printer, and skip all the drawing ....

Any idea how to do it not using PrintDocument ?

Thanks,
Kris


Nicholas Paldino said:
Kristijan,

Are you using the PrintDocument class to print your document? If so,
then you will have to use whatever calculations you would normally to
determine page size and whatnot, and predetermine the number of pages
before you do your printing. You can not go back and print on a page that
has already been printed, since most printers have no access to the
printed page once you have finished printing it (it's usually sitting in a
tray).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Kristijan Marin said:
Hi,

I need to print a report like document. So in report there are many
articles and what I need when I get to the end, is to update page
numbers on the second page where the Table of Content is .... or even
update strings like Page 1 or 10 ... Page 2 of 10 etc ....

When starting the report I don't know the total number of pages nor the
page number on which each and every article starts ....

Is it at all possible to make an update later on ? What I do now is to go
through the document twice ... .in first loop I collect the page numbers,
so I can update it later in the second run .....

If i could leave one page blank and update it later would also do the
trick if I can do this at all !?

Thanks.

Kris
 
Kristijan,

I can't think of a way. However, I think that there is no reason you
can't do your calculations/layout for the first page, and then cache the
results for the other pages after you have cycled through once.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Kristijan Marin said:
Hi Nicholas,

Yes I'm using PrintDocument and yes I was affraid of that answer.....:)

Is there any other possible way to do this, cause the report can have from
5-50 or more pages and because pages contain images and text doing
calculation twice takes "time" .... no matter that I do my first
calculation offscreen and off printer, and skip all the drawing ....

Any idea how to do it not using PrintDocument ?

Thanks,
Kris


Nicholas Paldino said:
Kristijan,

Are you using the PrintDocument class to print your document? If so,
then you will have to use whatever calculations you would normally to
determine page size and whatnot, and predetermine the number of pages
before you do your printing. You can not go back and print on a page
that has already been printed, since most printers have no access to the
printed page once you have finished printing it (it's usually sitting in
a tray).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Kristijan Marin said:
Hi,

I need to print a report like document. So in report there are many
articles and what I need when I get to the end, is to update page
numbers on the second page where the Table of Content is .... or even
update strings like Page 1 or 10 ... Page 2 of 10 etc ....

When starting the report I don't know the total number of pages nor the
page number on which each and every article starts ....

Is it at all possible to make an update later on ? What I do now is to
go through the document twice ... .in first loop I collect the page
numbers, so I can update it later in the second run .....

If i could leave one page blank and update it later would also do the
trick if I can do this at all !?

Thanks.

Kris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top