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

Distiller, PDFwriter, Crystal, and VFP

Status
Not open for further replies.

gregjohn

Technical User
Aug 13, 2001
29
0
0
US
I have a process that scans down a database, calls crystal reports, and prints a pdf using pdfwriter. The end result (ideally) is several thousand pdf files. Problem is, using pdfwriter, the report always opens within reader and system resouces get taxed after serveral hundred open files.

Within distiller, there is a check box to keep the report from opening in acrobat and to turn off the prompt for file name. Originally the pgmr who set this up implied it was a much more difficult to use distiller. I am beginning to wonder....

I created a dummy print driver that had the open distiller and prompt for filenme boxes checked off. Changed the crystal report to print to dummy print driver. Process seems to work except that the "pdfwriter way" for naming the file does not seem to work with distiller. Here is the pdfwriter code that is being used:

CRApplication = createobject("CrystalRuntime.Application")
CRReport = createobject("CrystalRuntime.Report")

CRReport = CRApplication.OpenReport("n:\crystal.rpt",1)

STORE -2147483647 TO nHKEY_CURRENT_USER
form_name.registry1.SetRegKey("PDFFileName", pdf_only_path + variable + '.pdf', 'Software\Adobe\Acrobat PDFWriter\', nHKEY_CURRENT_USER)
CRReport.PrintOut (.F.)
CRReport=''

where pdf_only_path and variable have been previously defined as the directory structure and pdf save filename, respectively.

Anyone have an idea how I could change the above code to incorporate a changing save file name with distiller?

Thanks
Greg
 
Greg,

I can't answer your question about Distiller, as I have no experience of it.

I have successfully used the DocuCom PDF printer driver. This has settings that let you specify a default output file, and also to inhibit the display of the PDF file after output. In other words, you can run the whole thing unattended and without consuming excessive resources.

If you get to the point of having to give up with Distiller, I'll give you more info on DocuCom. Most likely, Distiller will let you do what you want; you just need someone to point the way.

Mike
Mike Lewis
Edinburgh, Scotland
 
Greg,
it´s not that hard. I do the following:
- print the report to a postscript file (using the Adobe Universal Postscript Printer Driver)
- having done this: fire up Distiller oDistiller = createobject(´distiller.distiller.1´)
- parse the postscript file and it resulting pdf-file to the object with oDistiller.ps2pdf(<ps>, <pdf>)

This can be easily done from within VFP ensuring total control over the entire process. We do with on a webserver running a vfp-com object creating a pdf-file. Works like a charm....

Ron
 
Ron, first thanks for responding. I have the first step completed, but when I issue the create object command, I get the following error: &quot;class definition distilelr.distiller.1 not found&quot;.

I must admit, I really do not use classes in my work, so I don't really understand them. Any idea how i can get the class &quot;recognized&quot;.

Greg
 
Greg,

make sure you have Adobe Acrobat is installed. Not just the Reader but the full package including PdfWriter and Distiller. You can check this when looking at your printer drivers. Make sure Adobe Distiller is present.
In VFP you can check this with the following. Type in oAdobe = createobject(´pdfdistiller.pdfdistiller.1´)
If this does not return an error you have Distiller.

Once installed you can do the following:
- print your report to a postscript file (Install Adobe
Generic Postscript Printer Driver)
- start a Distiller oAdobe = createobject(´pdfdistiller.pdfdistiller.1´)
- oAdobe.filetppdf(<inputfile>,<outputfile>)

The <inputfile> is the postscript file, the <outputfile> is the ´to be created´ pdf-file.

One piece of advice. You are dealing with environments that really require you to understand ´objects´. You should educate yourself with this topic. It´s not easy but it is a necessity to know. Considering the fact that you are using VFP you are missing out a lot of things. Objects are complex but if you understand how to handle them they will make programming a lot nicer and easier.

Regards,

Ron
 
Greg,

if the error you posted is the exact error you get, you have spelled distiller wrong, you posted &quot;class definition distilelr.distiller.1 not found&quot;

Just copy paste the next line into your command window:

oAdobe = createobject(&quot;pdfdistiller.pdfdistiller.1&quot;)

this shouldn't give an error!

Hope it helps,

Charl
 
Thanks for the input. It works! But, another issue has come up.

I am trying to generate this pdf from a crystal report. (By the way, there have been several threads about using the export option within crystal, and I was able to get that to work. However, when I printed the pdf, the quality was subpar -- not really suitable for clients. I think the export option is viable if there is a way to improve the quality. Any ideas??)

So, if export quality is subpar, what I need to do is tell crystal to print to a postscript file. I am using the adobe generic postcript printer driver. One option is to set the driver to print to a file, but I am always prompted for an output filename. Anyone know how to programically tell the printer driver to print to file c:\example\xyz.ps without prompting me?

Alternatively, I suppose I could leave the printer driver set to lpt1 and, within the program, somehow &quot;tell&quot; crystal to print to a file. Unfortunately, the only crystal properties I have found (that control for printing to filename) are associated with exportoptions and do not work with crreport.printout. But I may be missing something. Can anyone provide guidance on the way to tell crystal 1) print to a file and 2) tell it what filename to save as.

Thanks
Greg



 
Greg,

the quality of the pdf file has nothing to with crystal. Having printed the report to a postscriptformat the resolution of the document is unlimited. Remember: postscript is not bitmap oriented but vector oriented.
The problem lies in the way Distiller is configured. You can indicate what type and quality of pdf file you want to create. Make sure these settings are correct.

Regards,
Ron
 
Ron

Here is where I am having trouble. I need to tell crystal to print to the adobe generic postcript driver and save the file somewhere. My code changes the default printer to be the poscript driver, and I know I could set the postcript driver to print to a file, but, when I do that, I get prompted for the filename.

So, somehow within my pgm (I think using a crystal setting) I must say &quot;print to filename&quot; and I then print to the postcript driver set to lpt1. This was the process I used to successfully print a foxpro report to the driver (report form abc.frx to file abc.ps). But I dont know the crystal code to do this.

Or, I could set the postcript driver to print to a file (instead of lpt1), but then, somehow, I need to tell it the filename and keep from prompting me. Any ideas?

The pdf quality problem I was having was using the export feature. Using exportoptions, you can tell crystal to print to a pdf filetype. That worked fine except the quality of the pdf file was not acceptable. I think your prior post assumed I went through the print driver - I don't think I did (unless the export feature would do that).

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top