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

Need help on FoxPro to print on Acrobat PDFWriter 5

Status
Not open for further replies.

angelleynes

Programmer
Dec 28, 2001
46
US
I need help on how to use Acrobat PDFWriter as a printer,basically, we have an existing application that never use Acrobat PDFWriter as a printer cause none of our clients requested it, but now that one did request it, we need to modify our program to print to Acrobat PDFWriter as well and also switch from Letter to Legal size, however, the documents that prints is still the old "@ Say" command meaning it's not a report form. can someone please help!

thanks in advance.
 
Hi

1. There is one utility called Win2PDF. Download it from the site..
The above installs a Win2PDF printer with its driver. The installtion is just a seconds job.


2. Number of ways to print.. Example.. any one of the chioices can be adapted...

a. In your output routine .. use the command...
SET PRINTER TO NAME "WIN2PDF"
REPORT FORM (rptFile) NOCONSOLE TO PRINTER

b.
REPORT FORM (rptFile) NOCONSOLE TO PRINTER PROMPT
while the prompt is shown... choose Win2PDF as your printer.

3. The flow will be the use will be asked a file name with a dalog box and the PDF will be created with that name in the chosen path/directory and also the PDF will be opened for viewing as if done in Print Preview.

In fact, if you have adapted (b) method in your programme, you dont have to modify that now.

If you have used @SAY methods... you can follow (a) method of SET PRINTER TO ..... and then put your code.

Hope this helps :)
ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
thanks Ramani, I'll try this out! however, the client doesn't want the dialog box to pop up, they just want to automatically create PDF file and save it to a default directory.

thanks!
 
is there any way to just create the docucom driver or add it in the registry programatically rather than for the client to download the driver?

thanks!
 
my next question is, we currently print documents of different paper size: i.e. loan number 123 is going to print 2 pages, 1 is the letter and the 2nd is the actual document which is legal, now, my question is, can these pages be in the same *.pdf file without separating them?

thanks!
 
angelleynes

The simple answer is no - the page format of a PDF format file is constant for the file.

To achieve what you want, you would need to create two different PDF files.

You could do this by writing the relevant data to the registry before creating the PDF.

Chris :)
 
thanks!, that brings me to another question, I haven't done anything about writing data to the registry, I new at registry thing. can you send me a sample?

thanks!
 
Assuming you installed the sample code from the MSDN Library CD, try:
do (_samples+"\solution\solution.app")

Then go down to the Windows API section - there are examples of reading and writing to the registry using the a foundation class.

Rick
 
angelleynes

The following code uses WinAPI calls to write to the registry.

You will need to determine the values to write and where to send them, but the code illustrates the basic principles.

LOCAL lcProperty,;
[tab]lcSoftWareKey,;
[tab]lcValue,;
[tab]lnDisplay,;
[tab]lnResult

lcSoftWareKey = [SOFTWARE\Zeon\DocuCom\PDF Driver\DocuCom PDF Driver]
lcProperty = [LogFile]
lcValue = [C:\My app\pdf_log.txt]
lnDisplay = 0
lnResult = 0

#DEFINE HKEY_LOCAL_MACHINE 2147483650
#DEFINE SECURITY_ACCESS_MASK 983103

DECLARE RegCreateKeyEx IN ADVAPI32.DLL ;
[tab]INTEGER ,;
[tab]STRING ,;
[tab]INTEGER ,;
[tab]STRING ,;
[tab]INTEGER ,;
[tab]INTEGER ,;
[tab]INTEGER ,;
[tab]INTEGER @ ,;
[tab]INTEGER @

DECLARE RegSetValueEx IN ADVAPI32.DLL ;
[tab]INTEGER ,;
[tab]STRING ,;
[tab]INTEGER ,;
[tab]INTEGER ,;
[tab]STRING ,;
[tab]INTEGER

RegCreateKeyEx(HKEY_LOCAL_MACHINE ,;
[tab]lcSoftWareKey ,;
[tab]0 ,;
[tab][REG_SZ] ,;
[tab]0 ,;
[tab]SECURITY_ACCESS_MASK ,;
[tab]0 ,;
[tab]@lnResult ,;
[tab]@lnDisplay)

RegSetValueEx(lnResult ,;
[tab]lcProperty ,;
[tab]0 ,;
[tab]1 ,;
[tab]lcValue ,;
[tab]13)

HTH

Chris :)
 
thanks Chris, I'm new at registry thing, anyway, I'll give this a try.

thanks!
 
I have the following procedure but it's not saving the file name.

***************************************
PROCEDURE SetPDFReg
***************************************
LPARAMETERS tcsize

DECLARE Integer RegOpenKeyEx IN Win32API ;
Integer hKey, String lpSubKey, Integer Reserved, ;
Integer samDesired, Integer @phkHandle

DECLARE Integer RegSetValueEx IN Win32API ;
Integer hKey, String lpszValueName, Integer dwReserved,;
Integer fdwType, String lpbData, Integer cbData

DECLARE Integer RegCloseKey IN Win32API ;
Integer nHKey

#DEFINE KEY_SET_VALUE 2
#DEFINE KEY_QUERY_VALUE 1
#DEFINE HKEY_CURRENT_USER -2147483647
#DEFINE REG_SZ 1

lHandle=0
adobe_key='Software\Adobe\Acrobat PDFWriter'+CHR(0)
result=RegOpenKeyEx(HKEY_CURRENT_USER, adobe_key,0,;
KEY_SET_VALUE, @lHandle)

IF result!=0 && it had an error
MESSAGEBOX('Error accessing registry!',16,'Rekon95')
RETURN
ENDIF

invalue="0"+CHR(0)
invaluesize=LEN(invalue)
result=RegSetValueEx(lHandle,'bdocinfo',0,REG_SZ, invalue,invaluesize)

invalue="1"+CHR(0)
invaluesize=LEN(invalue)
result=RegSetValueEx(lHandle,'bembedallfonts',0,REG_SZ, invalue,invaluesize)

invalue="0"+CHR(0)
invaluesize=LEN(invalue)
result=RegSetValueEx(lHandle,'bexecviewer',0,REG_SZ, invalue,invaluesize)

invalue="0"+CHR(0)
invaluesize=LEN(invalue)
result=RegSetValueEx(lHandle,'bsubsettruetype',0,REG_SZ, invalue,invaluesize)

invalue="0"+CHR(0)
invaluesize=LEN(invalue)
result=RegSetValueEx(lHandle,'bsubsettype1',0,REG_SZ, invalue,invaluesize)

invalue=k_drive+':\rekon\prints\'+RIGHT(DTOS(DATE()),6)+"_"+tcSize
IF FILE(invalue+'.PDF')
adder=65
DO WHILE FILE(invalue+"_"+CHR(adder)+".PDF")
adder=adder+1
ENDDO
invalue=invalue+"_"+CHR(adder)+".PDF"
ELSE
invalue=invalue+".PDF"
ENDIF
invaluesize=LEN(invalue)
result=RegSetValueEx(lHandle,'pdffilename',0,REG_SZ, invalue,invaluesize)

invalue=m_oper+CHR(0)
invaluesize=LEN(invalue)
result=RegSetValueEx(lHandle,'szAuthor',0,REG_SZ, invalue,invaluesize)

invalue="Rekon95"+CHR(0)
invaluesize=LEN(invalue)
result=RegSetValueEx(lHandle,'szCreator',0,REG_SZ, invalue,invaluesize)

result=RegCloseKey(lHandle)
IF result!=0 && it had an error
MESSAGEBOX('Error closing registry!',16,'Rekon95')
RETURN
ENDIF

CLEAR DLLS
RETURN
***************************************
 
well, I'm not doing anything about the web, the registry entry that I wrote works, except it's not saving the filename that I specify, however I'm using Windows 2000, so i thought that maybe it's going into the wrong key HKEY_CURRENT_USER OR HKEY_LOCAL_MACHINE.

THANKS!
 
Dear Sir/Madam,
I am a VFP beginner. I am very pleased to write this letter to yours. I have encountered a big problem in the pdf output. Would you please advise how to solve the below case. The case is:
I have written the vfp program with pdf output, which is not using any report tools to create formatted file. However, Recently, my boss requested the program should be automatically generated the pdf filenames by ponumber and he wants to be rollout on next weekend for Win2000, WinNT and Win98 machines. I have tried to use the 'wwpdf' program to enhance it. But it can not change the paper orientation for pdfwriter. I try to modify the 'pdfwritr.ini', but it still kept the old setting in 'Printer' under control panel. Even though I cross the ini file, but it can automatically to create the new one.
Would you advise any idea or suggestion or resource to solve this problem?

Best regards,
Wales.
 
waleslui

If your reports are included in the project, you need to open the project and exclude them.

You do this by right clicking on the report and selecting exclude.

You will also need to distribute them separately.

They are currently read-only as far as paper orientation and other properties are concerned.

What needs to be done is to open the reports and strip out the printer settings.

USE reports\myreport.frx IN 0
LOCATE
REPL expr WITH [],;
[tab]tag WITH [],;
[tab]tag2 WITH []
USE

Then open the report in the normal way, select the PDF driver, change the orientation and anything else and save the report. HTH

Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top