Printing - Page number paradox
Moderator: Rathinagiri
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Printing - Page number paradox
Hi,
I have a (basic) doubt in printing.
I want to print in every page of my report as 'Page No. 1/15, Page No. 2/15.....' like that.
The total number of pages can be found only after the last 'end printpage' command is given. So, how can I insert this last number of pages in the first page.
There are two possible ways.
1. First time do everything as we print and at the last instead of 'end printdoc' we can give 'abort printdoc' and find out the last page count. Then as usual print.
2. Insert the page number into every page before end printdoc.
IMHO, first method is possible but logically not right as it will consume double the processing time. For a big report running into pages, it may take much time.
Second method is logically right but is it possible? (to access a page on which already End PrintPage is given.
Or is there any other way?
I have a (basic) doubt in printing.
I want to print in every page of my report as 'Page No. 1/15, Page No. 2/15.....' like that.
The total number of pages can be found only after the last 'end printpage' command is given. So, how can I insert this last number of pages in the first page.
There are two possible ways.
1. First time do everything as we print and at the last instead of 'end printdoc' we can give 'abort printdoc' and find out the last page count. Then as usual print.
2. Insert the page number into every page before end printdoc.
IMHO, first method is possible but logically not right as it will consume double the processing time. For a big report running into pages, it may take much time.
Second method is logically right but is it possible? (to access a page on which already End PrintPage is given.
Or is there any other way?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Printing - Page number paradox
I had the same idea, but no idea hot to realize that
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Printing - Page number paradox
This is a big issue but it would wonderful to count with this resource.
I remember when I made EMF Viewer, all graphical printing creates metafiles for each page. Probably there is a way to re-edit it replacing lets say a kind of [TAG] by each number of page in string type. Just an idea...
If you want to look up it, see this topic:
viewtopic.php?p=37162#p37162
I remember when I made EMF Viewer, all graphical printing creates metafiles for each page. Probably there is a way to re-edit it replacing lets say a kind of [TAG] by each number of page in string type. Just an idea...
If you want to look up it, see this topic:
viewtopic.php?p=37162#p37162
Last edited by Pablo César on Fri Oct 21, 2016 11:16 am, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- serge_girard
- Posts: 3167
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Printing - Page number paradox
Rathi,
May be it is possible to count the records per page and divide by reccount() + headers + footers + ..?
Serge
May be it is possible to count the records per page and divide by reccount() + headers + footers + ..?
Serge
There's nothing you can do that can't be done...
Re: Printing - Page number paradox
Curious, I did some research.
I use FastReport for Xbase++. It has option to print total number of pages in report as in below image,
I observed that the in preview the total page numbers value change after the all pages of the report is generated. See that there is a "cancel" button on top which changes to "Close" upon completion of report. See also that the total page number value changes after "Close" is shown, as in below gif, (Also note that the position of the "page" text is shifted left)
If you save the report, it saves in XML format, see below image,
So I conclude that FastReport is generating XML file in memory and then doing search and replace in the XML at the end.
Further when I was doing coding in FoxPro (DOS), I used to run the report twice to get the total page numbers. First time I set printer to temp file, SET PRINTER TO TEMPX.TXT and get the total pages value in a variable.
Next time I set SET PRINTER TO PRINT and use the variable. I also found that SET PRINTER TO NUL performed same purpose, albeit very fast.
I do not know if we can implement the above in HMG, but may help other members to get an idea.
Regards,
Anand
I use FastReport for Xbase++. It has option to print total number of pages in report as in below image,
I observed that the in preview the total page numbers value change after the all pages of the report is generated. See that there is a "cancel" button on top which changes to "Close" upon completion of report. See also that the total page number value changes after "Close" is shown, as in below gif, (Also note that the position of the "page" text is shifted left)
If you save the report, it saves in XML format, see below image,
So I conclude that FastReport is generating XML file in memory and then doing search and replace in the XML at the end.
Further when I was doing coding in FoxPro (DOS), I used to run the report twice to get the total page numbers. First time I set printer to temp file, SET PRINTER TO TEMPX.TXT and get the total pages value in a variable.
Next time I set SET PRINTER TO PRINT and use the variable. I also found that SET PRINTER TO NUL performed same purpose, albeit very fast.
I do not know if we can implement the above in HMG, but may help other members to get an idea.
Regards,
Anand
mol
I'm creating reports with row heights depending from values, so record counting is unusable...serge_girard wrote:Rathi,
May be it is possible to count the records per page and divide by reccount() + headers + footers + ..?
Serge
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Printing - Page number paradox
Yes. I am also using wordwrap for long text. So record counting is unusable.
Running two times the print process is a raw solution IMHO. That may be used as a last resort!
Pablo's idea of changing the EMF/WMF file and replacing before start printing seems logical. But, can it be possible?
In HMG_PDF we can just select any page and insert anything even after creating all pages.
Running two times the print process is a raw solution IMHO. That may be used as a last resort!
Pablo's idea of changing the EMF/WMF file and replacing before start printing seems logical. But, can it be possible?
In HMG_PDF we can just select any page and insert anything even after creating all pages.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Printing - Page number paradox
I think it is possible because inside metafiles can be search a string opening, read and also be replaced, all in low level (I guess).Rathinagiri wrote:changing the EMF/WMF file and replacing before start printing seems logical. But, can it be possible?
Each EMF file created by Print preview option has at end of name, the number of page and could it be search the string (lets say) for "Page No. 1/@@" and replace only "@@" by the total quantity of that EMF files. Of course in our report we need to let the string in each page as a footer or as header.
What I see strings is each character spreaded (separated) with Chr(0) which also can be arranged.
I am now without my pc (is in the technician, probably it´s stressed too ) and I can not do much in this tablet...
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Printing - Page number paradox
Hi All,
I don't know anything about the internal structure of the EMF files, but just taking a quick look, it appears to be that strings are there, so, it could be only matter of put a placeholder for total pages in each one and then... DIRECTORY, MEMOREAD, STRTRAN, MEMOWRIT... you know...
In the following capture you can see PRINT DEMO string from HMG print demo:
Again... maybe I'm missing something important... sorry in advance.
I don't know anything about the internal structure of the EMF files, but just taking a quick look, it appears to be that strings are there, so, it could be only matter of put a placeholder for total pages in each one and then... DIRECTORY, MEMOREAD, STRTRAN, MEMOWRIT... you know...
In the following capture you can see PRINT DEMO string from HMG print demo:
Again... maybe I'm missing something important... sorry in advance.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: Printing - Page number paradox
voila un exemple de Mr Esgici dans facture hmg_hpdf dans viva clipper, dont les pages sont numérotées successivement.
voir le fichier pdf.
google traduction
here is an example of Mr Esgici in hmg_hpdf invoice viva clipper, with pages numbered consecutively.
see the pdf file.
voir le fichier pdf.
google traduction
here is an example of Mr Esgici in hmg_hpdf invoice viva clipper, with pages numbered consecutively.
see the pdf file.
- Attachments
-
- HPdfBill.zip
- (390.56 KiB) Downloaded 295 times
L'Algerie vous salut
Y.TABET
Y.TABET