Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing to a PDF
Message
From
11/01/2001 21:12:09
Elyse Pomerantz
Dynamic Data Concepts, Inc.
Brooklyn, New York, United States
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00462664
Message ID:
00462729
Views:
9
>>I am now able to print a report to a PDF, but I would ideally like to do it without any user interaction. Is there a way to programmatically tell it what file to print it to so the dialog doesn't come up?
>>
>>Thanks,
>
>Elyse,
>
>You may try the code bellow (adjust it to use the correct location of PDFMon.DLL. Another way: Rick's classes:
>
>
>*******************************************************************************
>*  Description.......: CreatePDF - creates PDF for specified filename
>*  Calling Samples...: CreatePDF('c:\temp\temp.pdf')
>*  Parameter List....: tcFileName
>*  Created by........: Houston Brennan 06/12/2000
>*  Modified by.......: Nadya Nosonovsky 06/16/2000 10:56:51 AM
>******************************************************************************
>lparameters tcFileName
>if empty(tcFileName)
>     tcFileName='c:\windows\temp\tempfile.pdf' && Hardcoded name
>endif
>
>local cPDFDllFile, lcOldSafety, iInitialise, iIsNT, ;
>     cPdfWriter, cPort, iInstalled, iDoPrompt, iSetFileName
>
>lcOldSafety=set('safety')
>cPDFDllFile = "c:\Program Files\Adobe\Acrobat 4.0\Macros\Office95\PDFMon.DLL" && or locate this DLL
>
>if not file(cPDFDllFile)
>     =messagebox("Required Acrobat Writer DLL is not present on your local drive." +;
>          chr(13)+"Will print to default printer...")
>     return .t.
>endif
>
>clear dlls
>declare integer PDFMonInitialize in (cPDFDllFile)
>declare integer PDFMonIsOSNT in (cPDFDllFile)
>declare integer IsPDFWriterInstalled in (cPDFDllFile) ;
>     string@ cPDFWriterName , ;
>     string@ cPort
>declare integer PDFMonDoPrompt in (cPDFDllFile) ;
>     integer iWhichProgram
>
>declare integer PDFMonSetPrompt in (cPDFDllFile) ;
>     integer iWhichProgram , ;
>     integer iNewValue
>
>#define SETPROMPTOFF 0
>#define SETPROMPTON 1
>
>declare integer PDFMonSetOutputFilename in (cPDFDllFile) ;
>     string cFileName
>declare integer PDFMonCleanup in (cPDFDllFile)
>
>iInitialise = PDFMonInitialize()
>*? "Initialise : "
>*?? iInitialise
>
>iIsNT = PDFMonIsOSNT()
>*? "Is NT : "
>*?? iIsNT
>set safety off
>cPdfWriter = space(100)
>cPort = space(100)
>iInstalled = IsPDFWriterInstalled( @cPdfWriter, @cPort )
>if iInstalled=1 && PDF Writer is installed
>     set printer to name 'Acrobat PDFWriter'
>endif
>*? "Installed "
>*?? iInstalled
>*? "PDF Writer : "
>*?? cPdfWriter
>*? "Port : "
>*?? cPort
>*?
>
>iDoPrompt = PDFMonDoPrompt( SETPROMPTOFF )
>*? iDoPrompt
>*cFileName = "c:\Temp\Test.Pdf"
>iSetFileName = PDFMonSetOutputFilename(tcFileName)
>*? iSetFileName
>*!*     tcFileName = ""
>*!*     iSetFileName = PDFMonSetOutputFilename(tcFileName)
>*!*     ? iSetFileName
>
>*? PDFMonCleanup()
>clear dlls
>if lcOldSafety='ON'
>     set safety on
>endif
>*? "Finished."
>return .t.
How do I use this with my REPORT FORM ... TO PRINTER ?

Thanks,
Elyse
Elyse Pomerantz
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform