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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing to PDF (Part II)

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB

I am making heavy weather of this! Using Wilhelm’s example of outputting to .pdf. I can get his example to work if I use a newly defined report layout, cc.frx. This format has been generated by the command CREATE REPORT cc.frx FROM cc (where cc is a cursor defined a few lines before)

Code:
.  oPDFC.cDefaultPrinter = “pdfCreator”
   SET PRINTER TO NAME (oPDFC.cdefaultprinter)
   REPORT FORM cc.frx NOCONSOLE TO PRINTER

This works fine.

If however I use an existing report, testcust.frx, which happens to have been defined with its output printer as my main printer “Brother”, the above sequence is not effective.

Code:
.  oPDFC.cDefaultPrinter = “pdfCreator”
   SET PRINTER TO NAME (oPDFC.cdefaultprinter)
   REPORT FORM testcust.frx NOCONSOLE TO PRINTER

. . . The output gets sent to the Brother printer as normal, and this is not what I want. If I look at the properties of testcust.frx I can see its printer is "Brother" and if I open it as a .dbf file I see that its ‘Expr’ memo field does indeed refer to Brother as do its Tag fields.

Is there a way that I can direct output from an existing report definition to a printer of my choice (in this case, to pdfCreator).

Thanks
 
Indeed. SET PRINTER TO NAME ... only affects VFPs default printer, not Windows default or the preset defined inside an FRX. So in the VFP report designer go into Report Properties and in the Page Layout tab uncheck "Save printer environment". Uncheck that.

The name of the printer shown in the "Printer" textbox is your current windwos default, which would be saved, if you check "Save printer environment". This only ever makes sense, if you design reports on site and the report must print at a certain printer. It makes no sense in any other circumstances, thus the old rule of thumb: Remove printer info from the first record of an frx of the Expr field.

Bye, Olaf.
 
Thanks tbleken and Olaf for helping to resolve this.

Yes, clearing fields in the first record of the frx achieves the result in cases where the printer name has been saved in the .frx.

Code:
   lcRepName = "myform.frx"
   Update (lcRepName) set Tag = "", tag2 = "" where ObjType = 1 and ObjCode = 53
   Use in (lcRepName)

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top