?
Solved

Counting the number of pages to be printed

Posted on 1998-06-28
8
Medium Priority
?
497 Views
Last Modified: 2010-04-04
I am working on a kiosk program. I would like to be able to provide printing capability but I need to be able to count the number of pages that will be printed before it starts printing in order to inform the user of the cost. Any suggestion on how I could do this ?
0
Comment
Question by:yvesmail
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:michaue
ID: 1356178
Are you using quick report ??
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356179
Or you already using a sort of report-printer, or do you have to make one yourself?
0
 
LVL 3

Expert Comment

by:vladika
ID: 1356180
You can preview report and count the number of pages manually :)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 3

Expert Comment

by:Matvey
ID: 1356181
Also you know the printer page height and width, and your fond height and width, so you can count ho much space it needs.
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1356182
-Font
0
 
LVL 3

Accepted Solution

by:
vladika earned 450 total points
ID: 1356183
If you use QuickReport ...

I read it in the QuickReport help

Declaration
property Data : TQRSysDataType

Purpose
The data property is used to select what system data item the TQRSysData component will print.

Value      Meaning
qrsPageCount      Displays the total number of pages in the report. Note that this requires that the report is prepared as a two pass report (TQuickRep.Options.TwoPass). This might take significantly longer time.

But I cannot find such Value, I think it's not implemented.

So, we can self write two pass report.
1) In QuickRep form create property PageCount as
  TForm1 = class(TForm)
    QuickRep1: TQuickRep;
    QRLabel1: TQRLabel;
//   ....................... other controls ..........
    procedure QRLabel1Print(sender: TObject; var Value: String);
  private
    FPageCount: Integer;
  public
    procedure FirstPass;
    property PageCount: Integer read FPageCount write FPageCount;
  end;

2) Set on form QRLabel - it will print PageCount

3) write QRLabel.OnPrint handler as
procedure TForm1.QRLabel1Print(sender: TObject; var Value: String);
begin
  Value := IntToStr(PageCount);  // print PageCount
end;

4) write method which will emaluate first pass
procedure TForm1.FirstPass;
begin
  PageCount := 0;
  QuickRep1.Prepare; // first pass
  PageCount := QuickRep1.PageNumber;  // set PageCount
  QuickRep1.QRPrinter.Free;  // free QRPrinter as write in help
  QuickRep1.QRPrinter := nil;
end;

5) before print or preview we can first call method FirstPass
for preview
  Form1.FirstPass;
  Form1.Preview;
for print
  Form1.FirstPass;
  Form1.Print;

or if you only want to count the number of pages
call FirstPass and read property PageCount


0
 

Author Comment

by:yvesmail
ID: 1356184
Isn't Quick Report for used to create database reports ? I wish to pront data displayed in a Web browser (I am using Internet Explorer ActiveX component). So this is to pront web pages.
0
 
LVL 3

Expert Comment

by:vladika
ID: 1356185
Reject my answer. I did not want autograde.

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.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

719 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