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

Can you print to a pdf file from Foxpro 2.6?

Status
Not open for further replies.

lmn

Programmer
Apr 3, 2003
60
US

I am trying to print a foxpro 2.6 report directly to a pdf file using the "Report form XX to printer" command. I have set up a generic printer that is set to a pdf port using a generic/text only driver. I keep getting this error message:
%%[ Error: undefined; OffendingCommand: &l5H ]%%
%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
%%[ Warning: PostScript error. No PDF file produced. ] %%

If I use the pdf driver, it seems to work ok, only I want to be able to automatically assign file names without having the filename selection window coming up. Any way around this?

Any help would be appreciated.
 
Thanks for the tip. Unfortunately, this web site was not much help. I have not worked with Foxpro for a long time. Is there any other way to save the report to a file? I know you can do it if the report writer is not used.

Ultimately, what I'm trying to achieve is to run a series of reports (a data dump of sorts) that saves the report files in pdf format (Or any other file format that can be imported into pdf format). The report uses a table that contains filenames that will be assigned to the resulting reports. When I use the pdf writer as my default printer, the window comes up prompting the user to enter a filename. I want to eliminate this window and use the filenames in my table. Any thoughts?

Again, any help is very much appreciated.
 
I have not done this from fox 2.6 but I have from VFP 6. Also, I was unable to get Foxpro to allow me to assign the PDF file name. It always used visual foxpro.pdf. Foxpro 2.6 would probably be foxpro.pdf. I just had to write code that renamed this file to whatever filename I really wanted it to be. I also used the Acrobat Distiller since the PDFWriter did not work for me. To recreate what I did first go to start programs adobe acrobat - distiller then choose the File menu, then preferences and uncheck the "Ask for PDF Destination" and the "Ask to replace existing PDF". This way it will not ask for the file name or if you wish to over write it. Then goto your printer settings and look at the properties on your existing Acrobat Distiller printer. Choose ports. The PDF Port will have a destination folder assigned to it. This is where it will place the PDF file. If this folder which is probably somewhere under your program files acrobat folder is unacceptable you can add a new printer using the Add printer button. Choose My Computer, choose add port then choose PDF port then new port. It will then bring up a browse window allowing you to select the destination folder. By the way, I am using Acrobat version 4.0. I don't think earlier versions work the same. Like I said, I have not tested any of this from Fox 2.6 but maybe it will work. Let me know if it does or does not or if you have other questions.
 
I print to a PDF from FoxPro 2.6 sucessfully. Big issues with doing this are version of Adobe PDF your operating system (mostly just the version of Adobe)(I am using NT workstation). It only works with older versions of Adobe, specifically I have only had luch with Adobe writer 3.02 (which should come with Adobe acrobat version 3) ( used to have a good document on the capibilities of each version but they changed their site and I can't seem to find it anymore) Not sure if you can still get the old versions or not.

If you can get an old copy you can write to the c:\winnt\system32\spool\drivers\w32x86\2\__pdf.ini file (only this version uses the ini file the newer versions use the registry file. Also other versions may not have the settings to set the filename and other options)
You can write to this ini file before calling report form
the ini has a heading of [Acrobat PDFWriter] and anywhere after that add:
PDFFileName={this is the path and name of the file you want created}
bExecViewer={this is logical whether you want to have the user view the screen that prompts for a name etc (I think set to 0 to not view it but it could be 1 sorry can't remember)

There are other options too like orientation etc. You must create a routine to save the current settings first before overwritting them and then set them back after the report has printed - otherwise any other time you print to a PDF these settings will be used (even if you print out of Word etc)

Hope this helps
 
Hi, I know this thread is very old, here is my solution. I print to a file called afile.ps. You have to learn some basic postscript commands. But postscript is much simpler than pcl code. (I do not use the report writers) You also need a copy of acrobat distiller loaded on your local machine. You also need to create a hot folder. When it is all set up all you get is a pdf file. The destination folder is preset, but the name can be a variable. Right now I am vistiting this site to try to get around the 8 charater file name limit.Works very good otherwise.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top