Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert Microsoft Word Doc to Adobe PDF
Message
From
28/01/2011 11:24:55
 
 
To
15/04/2008 00:44:02
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01310539
Message ID:
01497666
Views:
99
You must create the PDFCreator object first. Then make it your default printer so you want to store your current default printer. However, if your program fails unexpectedly your default printer will be stuck on the PDFCreator. At least with the version I used.
oPDFJob = CREATEOBJECT("PDFCreator.clsPDFCreator", "PDFCreator_")
oPDFJob.cStart("/NoProcessingAtStart")
OldPrinter = oPDFJob.cDefaultPrinter
oPDFJob.cVisible = .F.
oPDFJob.cDefaultPrinter = "PDFCreator"
Here is how to create the document
WITH PDFJob
                     .cClearCache
	.cVisible = .F.
	.cStart("/NoProcessingAtStart")
	.cOption("StartStandardProgram") = 0
	.cOption("StandardAuthor") = “JOHN DOE” **Optional
	.cOption("StandardTitle") = <FILE NAME> **Optional
	.cOption("StandardSubject") = <File Subject> **Optional
	.cOption("AutosaveStartStandardProgram") = 0
	.cOption("ShowAnimation") = 0
	.cOption("UseStandardAuthor") = 1
	.cOption("UseAutosave") = 1  && 0=PDF
	.cOption("UseAutosaveDirectory") = 1
	.cOption("AutosaveDirectory") = newDir &&Directory to store pdf in
	.cOption("AutosaveFilename") = sTitle  &&Name of the file you want to save
	.cOption("AutosaveFormat") = 0
	.cPrinterStop = .F.
	.cPrintFile(ADDBS(SYS(2023))+"c:\document.doc")  &&Name of the doc you want to convert
ENDWITH
Then I usually reset all the options back to default when finished
*** SET ALL DEFAULTS BACK TO NORMAL ***
WITH PDFJob
	.cDefaultPrinter = OldPrinter
	.cStart("/NoProcessingAtStart")
	.cOption("StartStandardProgram") = pdfjob.cStandardOptions.StartStandardProgram
	.cOption("StandardAuthor") = pdfjob.cStandardOptions.StandardAuthor
	.cOption("StandardTitle") = pdfjob.cStandardOptions.StandardTitle
	.cOption("StandardSubject") = pdfjob.cStandardOptions.StandardSubject
	.cOption("AutosaveStartStandardProgram") = pdfjob.cStandardOptions.AutosaveStartStandardProgram
	.cOption("ShowAnimation") = pdfjob.cStandardOptions.ShowAnimation
	.cOption("UseStandardAuthor") = pdfjob.cStandardOptions.UseStandardAuthor
	.cOption("UseAutosave") = pdfjob.cStandardOptions.UseAutoSave
	.cOption("UseAutosaveDirectory") = pdfjob.cStandardOptions.UseAutosaveDirectory
	.cOption("AutosaveDirectory") = pdfjob.cStandardOptions.AutosaveDirectory
	.cOption("AutosaveFilename") = pdfjob.cStandardOptions.AutosaveFileName
	.cOption("AutosaveFormat") = pdfjob.cStandardOptions.AutosaveFormat
	.cPrinterStop = pdfjob.cStandardOptions.PrinterStop
	.cVisible = .T.
	.cStart(pdfjob.cStandardOptions.NoProcessingAtStartup)
	.cClose()
ENDWITH
RELEASE PDFJob
That should be about it. Hope this helps.
Justin
Previous
Reply
Map
View

Click here to load this message in the networking platform