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

PDF using westwind pdf maker

Status
Not open for further replies.

jimoo

Programmer
Joined
Jun 2, 2003
Messages
1,111
Location
US
Has anyone used wwpdf.prg by Rick Strahl?

I am using a Win 2000 pc, VFP 6, and acrobat pdf writer 8.

Here is my calling code to test it.

Code:
#INCLUDE p:\r01plusdev\data\wconnect.h

* standard way
* use employee
* report form eestatus preview

IF !USED('employee')
	SELECT 0
	USE employee
ELSE
	SELECT employee
ENDIF		

SET PROCEDURE TO
SET PROCEDURE TO wwapi.prg ADDITIVE
SET PROCEDURE TO wwpdf.prg ADDITIVE
SET PROCEDURE TO wwutils.prg ADDITIVE
SET PROCEDURE TO wweval.prg ADDITIVE

loPdf = CREATEOBJECT('wwPDF40')

* method in wwpdf.prg
loPDF.printreport('eestatus', 'c:\$pdf\jotest.pdf')

The code successfully executes, except it only creates one file, a .ps file. The comments (included) indicate that it should create a 2nd file with a .ps.pdf extenstion. It renames that file to the final output pdf file. However, since it does not exist, it is unable to rename it and the output file is never created.

Here is sample code in wwpdf:

Code:
loEval = CREATE("wwEval")
loEval.ExecuteCommand("SET PRINTER TO NAME '" +THIS.cPrinterDriver +"'")
IF loEval.lError
wait window "ERROR: " + loEval.cErrorMessage
   THIS.cErrorMsg = "Couldn't set printer to " + THIS.cPrinterDriver
   RETURN .F.
ENDIF   

SET PRINTER TO NAME (THIS.cPrinterDriver)

*** We'll create a Postscript Output File

* original code
lcTFile = SYS(2023) + "\" + SYS(2015) + ".ps"
lcTFile = "c:\$pdf\boo.ps"

REPORT FORM (lcReport) &lcExtraReportClauses NOCONSOLE TO FILE &lcTFile
SET PRINTER TO

*** Get rid of the PS file - empty.
*** Distiller will automatically create a PDF file with ps.pdf extension

*** Note: PDFWriter will create two files .ps and .ps.pdf
***       the latter of which contains the actual output data


* MY COMMENTS
***********************************************************
* NOTE: the .ps.pdf file is not created.  Therefore, it cannot 
* be renamed
***********************************************************

ERASE (lcTFile)
lcTFile = lcTFile + ".pdf"
IF FILE(lcTFile)
   *** Move the temp file to the actual file name by renaming
	RENAME (lcTFile) TO (lcOutputFile)
ELSE 
    THIS.cErrorMsg = "Output file not created"
    RETURN .F.
ENDIF
    
RETURN .T.

Using the SHELLEXECUTE API I am able to create the pdf files. It brings up the distiller. However, this is kind of a goofy work around. I suspect it should work, but maybe I am missing something simple?

Anyone have experience with this?

Jim Osieczonek
Delta Business Group, LLC
 
Jim,
I don't believe Rick's code work "right" with the newer versions of Acrobat - I belive it was written with 4.0 & 5.0 in mind. (Based on the included Help file.)

Have you tried posting on his support site?

Rick
 
No, that was my next choice.

I have a work around using the shellexecute to launch the distiller. The report is then created. It leaves the distiller dialog up, and I may need to address that issue, or have the user close it. The distiller dialog is useful in that it provides nice feedback.

I'll see what the ww group says and let you all know.

Jim

ps. my acrobat version is 6.0, not 8.0 as I previously mentioned. 6.0 is the latest.

Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top