Monday, January 6, 2014

Printer Environment on Report, when to save and when not to!

In earlier versions of VFP (before 9), Printer Environment is by default saved onto the report itself.  But then there are cases where because of that, when our app is installed on a client's machine and that machine has a different printer than what we have when we design the report and compiled the app into exe, the report output on the client machine may generate a much different output than what we are expecting like difference on dimensions, margins, font sizes, spaces, some portion cut-off, etc.  And the solution to those problems is to hack into the FRX and clear out these printer environment from within so it will be free of the settings of a "specific" printer.

For these reasons, in VFP9, VFP team saw the need to reverse the process by not saving printer environment anymore within the report.  They made it optional by adding a checkbox in Page Setup of a report that allows us to save or not printer environment.  And by reverse, I mean the default now is it is no longer saved.

Question is, if saving printer environment results to unwanted outputs that has often led developers in lower versions of VFP to always hack the frx files, why should we tick it then?  Why is this option still given to us?  Why not simply remove this feature?  Is there still any use for this?


Yes of course, VFP designers won't place something useless in our beloved VFP.  Here is a scenario:

* A machine has two printers installed, a POS and a NON-POS one.
* Receipts/Invoices using @ say to be printed to the POS printer
* Rest of the reports on an frx-base, to be printed onto the NON-POS printer

What we normally do in this case is:

* Make the POS printer the default OS printer
* When we need to print onto the NON-POS one, we switch printer via either GETPRINTER() or SET PRINTER TO NAME commands

And that will do the trick!

But then, is that the only way to achieve such? Nope!

One easy way to ensure that the frx-based report will prioritize the NON-POS printer even though the default OS printer is the POS one, is to open the frx intended for the non-POS printer, change the printer inside its page setup to that NON-POS, then save printer environment.

What will happen when we do that is the printer environment of the selected printer will be stored onto the report.  So now, regardless of what is the default printer, that printer selected and stored inside the frx will be prioritized automatically by VFP as long as that printer is connected on the local machine or on the network; without the need of printer redirection by codes thru SET PRINTER TO NAME or GETPRINTER() commands.

I hope this gives you some further ideas of this Save Printer Environment feature.

6 comments:

  1. Nice Post Mr. Jun,
    May I Know, Where Is Flag In Report FRX / How To Set Save Or UnSave Printer Environtment programaticly in VFP

    ReplyDelete
    Replies
    1. See these:

      http://www.ml-consult.co.uk/foxst-12.htm
      http://fox.wikis.com/wc.dll?Wiki~FrxTips

      Delete
  2. What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. article to read about 3D printers buyer guide

    ReplyDelete
  3. When a blind man bears the standard pity those who follow…. Where ignorance is bliss ‘tis folly to be wise…. print brochures for cheap

    ReplyDelete
  4. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. 羅氏鮮是什麼

    ReplyDelete
  5. You might also want to try and look for printer fax copier since they can be a good value in the home or office setting. renting impresoras zaragoza

    ReplyDelete