Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Counting the number of pages to be printed

Posted on 1998-06-28
8
Medium Priority
?
503 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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

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.

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

926 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