Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PRINTER PROMPT

Status
Not open for further replies.

AlastairP

Technical User
Feb 8, 2011
286
AU
Good afternoon people

With the below method of printing a report, is there a way to set the total pages in the print diaglog

Code:
REPORT FORM (lcReport) NOCONSOLE TO PRINTER PROMPT
 
Do you mean "Set" or "see"? Have you checked in Help, you have this clause: "[RANGE nStartPage [, nEndPage]]"

If you need more help, please specify VFP version. And be more specific about what you want.
 
I think of a recent case where I only needed one page of a contract for signing. This has nothing to do with VFP, I printed a PDF page from a PDF viewer.
The only way I knew the page is because I can see the PDF document before even starting to print or preview it.

In that sense, the option to pick pages from a preview and only print selected pages isn't a norm. It only seems so if you see viewing a document or PDF as preview.
Preview is the preview of what will be printed and you can overall cancel it overall or not.

Nevertheless, I'm not sure what the VFPX foxy previewer print toolbar offers. I know you can choose to redirect output to an Excel sheet from preview, this works with a reportlistener and the print pass of its rendering methods. As you can do such a redirect I'm quite sure that rendering method could also simply skip pages and only print some.

But the classic way is specifying pages or number of copies (if you meant that) before going to print.

And since a report is data and not document driven and you only know how the data spans pages with a rendered preview, the usual way is to preview the report, remember page numbers you want, cancel, specify page numbers and go back to print, perhaps that time without preview.

If your report is composed of certain groups of data it would be easier to make the choice on the level of data and not based on pages.

Bye, Olaf.


Olaf Doschke Software Engineering
 
This will show the Windows printer prompt and after you hit the print button it will give you the parameters selected which then you can hack the report and insert the collected parameters into the tag2 field.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks Mike,
I will have a look at this

Alastair
 
Hi Mike,
I have had a quick look at this class.
What I really want to do is get the total page count into the print dialog box.
Is there a way to pass parameters to the dialog box such as pagecount?

Alastair
 
What I showed is the default windows printer prompt, where do you this page count fitting?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
If I do REPORT FORM TO PRINTER PROMPT I get a Windows OS printer choice dialog also allowing me to choose to print all pages or a range.

What do you mean with "set total pages"? AS Tore asked initially did you actually mean see or set?

To make a choice, eg only print page 2 works, any page choice you do will be based on having seen a preview, doesn't it? So does it really matter what the dialog displays you will need to print with preview first, then pick pages.

The easiest solution will be using foxypreviwer with REPORT FORM (lcReport) NOCONSOLE PREVIEW, because you'll see preview, number of pages, have a printer setting button to get to the dialog you also see with PROMPT and then know what you want to print and can set pages accordingly.

Bye, Olaf.


Olaf Doschke Software Engineering
 
Alastair,

You can't customise the dialogue that appears as a result of the [tt]TO PRINTER PROMPT[/tt] clause (as far as I know). But there is nothing stopping you from creating your own dialogue, and displaying it immediately before your [tt]REPORT FORM[/tt].

That dialogue would be a normal VFP form, arranged to look similar to the standard Print dialogue. You would use APRINTERS() to populate the list of available printers. To get the total number of pages, you would have to do a dummy pass of the report, capturing the value of _PAGETOTAL at the end (in other words, put an On Entry expression in the report's Summary Band properties; the expression would store the value of _PAGETOTAL in a variable, which you can then use to populate the "total pages" box in in your dialogue).

After dispalying the dialogue, you would print the report as usual, without the [tt]TO PRINTER PROMPT[/tt] clause. You would [tt]SET PRINTER[/tt] to the printer chosen in the dialogue. You would use the [tt]RANGE[/tt] clause to specify which pages to print. And you would issue the [tt]REPORT FORM[/tt] command multiple times, depending on the number of copies selected.

I know it sounds a bit complicated, but it would give you total control over the dialogue and the information that it returns.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,
Yes, I feared that would be what I would have to: Build a dialog box.
When I use 'TO PRINTER PROMPT', in the dialog box it where there is the option to select "All" or "Pages", the page number in the text box is 1-65534.
That is what I am trying to change. What I see there.

Alastair
 
I guess it depends how badly you want to do this. I can see that, if the report is only, say, 23 pages, then it is better to show 1-23 than 1-65534. But that's at the expense of creating your own dialogue form, with all the design and coding and testing that involves.

Personally, I'd be inclined to leave it as it is. If someone comes up with any easy way of doing what you want, then go for it. If not, devote your energies elsewhere.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Yes, since this prompt comes when the print is initializing before it knows how many pages will result from the FRX, there always is this default range 1-65536

This changes with foxyPreviwer, in that you can first see the preview and pages and then click for printer choice and printer preferences, as the preview toolbar then has a printer settings button going into that dialog.

So again, I recommend you use foxypreviewer and the problem solves itself. The preview shows the number of pages and so for example when someone knows he needs the last page, he can set printer preferences to that page number.

The prompt dialog is appearing with the highlighted button of the preview toolbar:
preview_dnm8ax.jpg


Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top