Re: Any way to convert Word document to PDF in VFP with OLE Automation? by tim_witort
tim_witort
Wed Apr 23 14:16:33 CDT 2008
Zoom seemed to utter in
news:7t6dndWVYIl77ZfVnZ2dnUVZ_g6dnZ2d@comcast.com:
> "Tim Witort" <tim_witort@hotmail.com> wrote in message
> news:Xns9A84600E4BDBCtimwitortwrotethis@216.196.97.131...
>> Zoom seemed to utter in
>> news:3vednTmRasMiAJXVnZ2dnUVZ_s2tnZ2d@comcast.com:
>>
>>> Hi,
>>>
>>> I am trying to automatically convert a word file to PDF. I have a
>>> Adobe PDF print driver which when you print to it asks for a PDF
>>> filename and then generates a PDF file as a print image. Is there
>>> anyway to automate this process in VFP - to be able to print directly
>>> to this print driver and supply a predefined filename for the PDF
>>> file?
>>
>> I do this, but I'm not using Acrobat's PDF printer. I use
>> Amyuni's PDF printer:
>>
>> *
>> * Set PDF output file name:
>> *
>> This.PDFWriter.FileNameOptions = 1 + 2
>> This.PDFWriter.DefaultFileName = lcSomeFileName
>>
>> *
>> * Direct Word to print to the PDF Writer:
>> *
>> This.WordObj.ActivePrinter = "PDF Writer"
>>
>> This.WordObj.Application.PrintOut(.F., .F., wdPrintAllDocument, "", ,
>> , ;
>> wdPrintDocumentContent, 1, , wdPrintAllPages, .F., .T., "", , , 0,
>> 0, 0, 0)
>>
>> We used to use Acrobat, but were running into problems when
>> user's weren't running the same version of Acrobat. Switched
>> to Amyuni and now all the PDF functions are built into our
>> application - no need for Acrobat at all.
>>
>> When we used to use Acrobat, we would need to set a registry
>> entry for the file name to print to, then print to the
>> Acrobat PDF Writer. With Amyuni, we just set properties on
>> the Amyuni PDF writer object as shown in the first two
>> code lines above.
> Appreciate the info. Do you have specific examples with the Adobe
> Print Driver?
The only thing different is setting the output filename
in the registry:
*
* Create an instance of the registry tool:
*
loRegistry = CREATEOBJECT("registry")
*
* Set the output file name:
*
loRegistry.SetRegKey("PDFFileName", tcPDFFile, ;
"Software\Adobe\Acrobat PDFWriter", HKEY_CURRENT_USER)
*
* Make sure PDF Writer is not set to open Acrobat after printing:
*
loRegistry.SetRegKey("bExecViewer", "0", ;
"Software\Adobe\Acrobat PDFWriter", HKEY_CURRENT_USER)
-- TRW
_______________________________________
t i m . w i t o r t
_______________________________________