I have a large VFP application I inherited. There is a function I
made to create a PDF from a report and email the PDF file.

I send the output to a file using the command

REPORT FORM MyReport NOCONSOLE TO FILE MyResultFile.ps

I then use GhostScript to create a PDF. Everything works fine the
FIRST time, but the next time I run the REPORT FORM command, the
output is sent to the default printer and not a file. In trying to
find the problem, I have used DISPLAY MEMORY TO FILE both times to
compare the contents of memory. I have done the same with DISPLAY
STATUS. I do not see any glaring differences that would prevent the
output to a file the second time around. If I exit the application
and reenter each time, the report is sent to a file successfully. It
only fails if I _don't_ exit the application and it only fails after
the first run. I have verified the printer is being set correctly and
the SET('PRINTER', 3) is the printer with the postscript driver.

This definitely seems like a bug in VFP since a file is not created
and the REPORT FORM command should produce a file because of the "TO
FILE".

Any ideas?

Re: Sending report to file by Carsten

Carsten
Thu Mar 22 02:31:04 CDT 2007

Mark,

just an idea.
The first time you use the report, are you extracting it from the
exe/memofield, or copying it from another report?
If so, open the report as a table (USE MyReport.FRX) and go to the first
record. Take a look at the content of the Expr-Field (Lines beginning with
"DRIVER", "DEVICE" and/or "OUTPUT"). Maybe you see something suspicious.

--
Cheers
Carsten
_______________________________

"Mark" <mminnie@minniebyte.com> schrieb im Newsbeitrag
news:1174515545.141401.131180@n59g2000hsh.googlegroups.com...
>I have a large VFP application I inherited. There is a function I
> made to create a PDF from a report and email the PDF file.
>
> I send the output to a file using the command
>
> REPORT FORM MyReport NOCONSOLE TO FILE MyResultFile.ps
>
> I then use GhostScript to create a PDF. Everything works fine the
> FIRST time, but the next time I run the REPORT FORM command, the
> output is sent to the default printer and not a file. In trying to
> find the problem, I have used DISPLAY MEMORY TO FILE both times to
> compare the contents of memory. I have done the same with DISPLAY
> STATUS. I do not see any glaring differences that would prevent the
> output to a file the second time around. If I exit the application
> and reenter each time, the report is sent to a file successfully. It
> only fails if I _don't_ exit the application and it only fails after
> the first run. I have verified the printer is being set correctly and
> the SET('PRINTER', 3) is the printer with the postscript driver.
>
> This definitely seems like a bug in VFP since a file is not created
> and the REPORT FORM command should produce a file because of the "TO
> FILE".
>
> Any ideas?
>



Re: Sending report to file by Cindy

Cindy
Thu Mar 22 10:27:48 CDT 2007

Hi Mark,

I've used Print2PDF to create PDFs and then have automation code to email
them, much as you are trying to do. Print2PDF is a free download from the
UniversalThread. (www.universalthread.com >
Downloads from the list on the left > Download ID: 13851)


--
Cindy Winegarden
cindy@cindywinegarden.com


VFP OLE DB: http://msdn2.microsoft.com/en-us/vfoxpro/bb190232.aspx
VFP ODBC: http://msdn2.microsoft.com/en-us/vfoxpro/bb190233.aspx




"Mark" <mminnie@minniebyte.com> wrote in message
news:1174515545.141401.131180@n59g2000hsh.googlegroups.com...
>I have a large VFP application I inherited. There is a function I
> made to create a PDF from a report and email the PDF file.
>
> I send the output to a file using the command
>
> REPORT FORM MyReport NOCONSOLE TO FILE MyResultFile.ps
>
> I then use GhostScript to create a PDF. Everything works fine the
> FIRST time, but the next time I run the REPORT FORM command, the
> output is sent to the default printer and not a file. In trying to
> find the problem, I have used DISPLAY MEMORY TO FILE both times to
> compare the contents of memory. I have done the same with DISPLAY
> STATUS. I do not see any glaring differences that would prevent the
> output to a file the second time around. If I exit the application
> and reenter each time, the report is sent to a file successfully. It
> only fails if I _don't_ exit the application and it only fails after
> the first run. I have verified the printer is being set correctly and
> the SET('PRINTER', 3) is the printer with the postscript driver.
>
> This definitely seems like a bug in VFP since a file is not created
> and the REPORT FORM command should produce a file because of the "TO
> FILE".
>
> Any ideas?
>



Re: Sending report to file by Mark

Mark
Thu Mar 22 14:47:15 CDT 2007

I am using Print2PDF. Around line 793 in the MakePS() function, is
the line :

report form (lcReport) &lcExtra noconsole to FILE (lcPSFile)

This is the line causing problems. It doesn't print to the file, but
the printer. That is why I am so confused.


On Mar 22, 8:27 am, "Cindy Winegarden" <c...@cindywinegarden.com>
wrote:
> Hi Mark,
>
> I've used Print2PDF to create PDFs and then have automation code to email
> them, much as you are trying to do. Print2PDF is a free download from the
> UniversalThread. (www.universalthread.com>
> Downloads from the list on the left > Download ID: 13851)
>
> --
> Cindy Winegarden
> c...@cindywinegarden.com
>
> VFP OLE DB:http://msdn2.microsoft.com/en-us/vfoxpro/bb190232.aspx
> VFP ODBC:http://msdn2.microsoft.com/en-us/vfoxpro/bb190233.aspx
>
> "Mark" <mmin...@minniebyte.com> wrote in message
>
> news:1174515545.141401.131180@n59g2000hsh.googlegroups.com...
>
> >I have a large VFP application I inherited. There is a function I
> > made to create a PDF from a report and email the PDF file.
>
> > I send the output to a file using the command
>
> > REPORT FORM MyReport NOCONSOLE TO FILE MyResultFile.ps
>
> > I then use GhostScript to create a PDF. Everything works fine the
> > FIRST time, but the next time I run the REPORT FORM command, the
> > output is sent to the default printer and not a file. In trying to
> > find the problem, I have used DISPLAY MEMORY TO FILE both times to
> > compare the contents of memory. I have done the same with DISPLAY
> > STATUS. I do not see any glaring differences that would prevent the
> > output to a file the second time around. If I exit the application
> > and reenter each time, the report is sent to a file successfully. It
> > only fails if I _don't_ exit the application and it only fails after
> > the first run. I have verified the printer is being set correctly and
> > the SET('PRINTER', 3) is the printer with the postscript driver.
>
> > This definitely seems like a bug in VFP since a file is not created
> > and the REPORT FORM command should produce a file because of the "TO
> > FILE".
>
> > Any ideas?



Re: Sending report to file by Gene

Gene
Thu Mar 22 17:30:00 CDT 2007

"Mark" <mminnie@minniebyte.com> wrote:

>I am using Print2PDF. Around line 793 in the MakePS() function, is
>the line :
>
>report form (lcReport) &lcExtra noconsole to FILE (lcPSFile)
>
>This is the line causing problems. It doesn't print to the file, but
>the printer. That is why I am so confused.

This sounds like a problem I recently ran into. The .frx
contains specific printer data, and this data appears to determine the
printer used, even to the point of ignoring a set printer to name
setting. Try removing the printer specific entries in the .frx.

I have two reports that I use to configure printers/drivers. I
copy the report I need to a temporary file and use that. Any changes
that VFP makes to the temporary file end up being deleted.

[snip]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Sending report to file by Mark

Mark
Fri Mar 23 04:36:55 CDT 2007

Hey...that worked! I don't know why I didn't think of that as the
EXPR and TAG, TAG2 stuff has caused all sorts of problems in the
past. Thanks a bunch!

On Mar 22, 3:30 pm, Gene Wirchenko <g...@ocis.net> wrote:
> "Mark" <mmin...@minniebyte.com> wrote:
> >I am using Print2PDF. Around line 793 in the MakePS() function, is
> >the line :
>
> >report form (lcReport) &lcExtra noconsole to FILE (lcPSFile)
>
> >This is the line causing problems. It doesn't print to the file, but
> >the printer. That is why I am so confused.
>
> This sounds like a problem I recently ran into. The .frx
> contains specific printer data, and this data appears to determine the
> printer used, even to the point of ignoring a set printer to name
> setting. Try removing the printer specific entries in the .frx.
>
> I have two reports that I use to configure printers/drivers. I
> copy the report I need to a temporary file and use that. Any changes
> that VFP makes to the temporary file end up being deleted.
>
> [snip]
>
> Sincerely,
>
> Gene Wirchenko
>
> Computerese Irregular Verb Conjugation:
> I have preferences.
> You have biases.
> He/She has prejudices.