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!

VFP, Adobe PDF writer, and Citrix

Status
Not open for further replies.

VBFOXDEV35

Programmer
Mar 26, 2001
77
US
All: This one is an interesting question.

I have an application that is multi-user due to a citrix connection. My problem is some of the reports require PDF writer to create reports. On standard Windows OS's (XP, 2000, 98, etc) I have no problem. But once I get to citrix, all hell breaks loose.

I have 3 functions I use to check to see:
A) what is the current OS
b) To get the PDF Profile string
c) and to set it in code for later use.

here are the functions

FUNCTION NTKernel
Declare Long GetVersion in WIN32API
RETURN (GetVersion() > 0)

***********************************************************FUNCTION PDFIni
Declare Long GetVersion in WIN32API
LOCAL strReturn

IF NTKernel() THEN
DO CASE
* This case added in becasue of the citrix server
CASE FILE("M:\WINNT\SYSTEM32\SPOOL\DRIVERS\W32x86\2\PDFDD.dll")
strReturn = "M:\WINNT\SYSTEM32\SPOOL\DRIVERS\W32x86\2\__pdf.ini"
** these below are for any Windows XXXX OS
CASE FILE("C:\WINNT\SYSTEM32\SPOOL\DRIVERS\W32x86\2\PDFDD.dll")
strReturn = "C:\WINNT\SYSTEM32\SPOOL\DRIVERS\W32x86\2\__pdf.ini"
CASE FILE("C:\WINDOWS\SYSTEM32\SPOOL\DRIVERS\W32x86\2\PDFDD.dll")
strReturn = "C:\WINDOWS\SYSTEM32\SPOOL\DRIVERS\W32x86\2\__pdf.ini"
ENDCASE
ELSE
strReturn = "C:\WINDOWS\SYSTEM\PDFWRITR.INI"
ENDIF
RETURN (strReturn)

***********************************************************
FUNCTION GetPDFFile
LOCAL RTVL, strPDFFileName,strINITemp

Declare Long GetPrivateProfileStringA in WIN32API String lpSection, String lpSetting, ;
String lpDefault, String @ lpReturnedString, Long nSize, String lpFileName
strPDFFileName = SPACE(255)
strINITemp = IIF(NTKernel(),PDFIni(),"C:\WINDOWS\WIN.INI")
rtvl = GetPrivateProfileStringA("Acrobat PDFWriter", "PDFFileName", "", @strPDFFileName, ;
255, StrINITemp)
IF RTVL > 0 .AND. !EMPTY(strPDFFileName)
IF CHR(0) $ strPDFFileName
strPDFFileName = LEFT(strPDFFileName, AT(CHR(0), strPDFFileName)-1)
ENDIF
ENDIF
IF CHR(0) $ strPDFFileName
strPDFFileName = LEFT(strPDFFileName, AT(CHR(0), strPDFFileName)-1)
ENDIF
Clear DLLs
RETURN strPDFFileName

***********************************************************
FUNCTION SetPDFFile
LPARAMETERS strPDFFile
Declare Long WritePrivateProfileStringA in WIN32API AS SetPrivateProfileString ;
String lpSection, String lpSetting, String lpValue, String lpFileName
rtvl = SetPrivateProfileString("Acrobat PDFWriter", "PDFFileName", strPDFFile, ;
PDFIni())
Clear DLLs
RETURN RTVL


Any ideas on how to get each citrix user the ability to create their own reports and not butt heads with anything else?

Thanks all for any thoughts.

Art
Art DeGaetano II
Software Developer, MOUS
 
("M:\WINNT\SYSTEM32\SPOOL\DRIVERS\W32x86\2\PDFDD.dll"

how can you be sure that M drive exist

remember, the user is running the program and it is actually running on the citrix server. Since you did not give exactly were the error is comming from. I suggest that you keep in mine that your program is not running on the pc of the user. Attitude is Everything
 
just like windows terminal services, citrix session is being run on the server and not on the client pc. Is your PDFWriter also reside/installed on the server just like your networked-citrix printer(s)?

Peping
 
Yes, we have the full version of Adobe installed on the server. All of the calls to work. I check them with messageboxes before they execute and the path's are correct for the files.

I think the problems is with this mergePDF function another co-developer created. Then this code executes, I receive the "Error opening document" generated by Adobe:

FUNCTION MERGEPDF
PARAMETERS P_NAME1,P_NAME2
ACR = CreateObject("AcroExch.App")
AV1 = CreateObject("AcroExch.AVDoc")
AV2 = CreateObject("AcroExch.AVDoc")
PD1 = 0
PD2 = 0

P_NAME1 = c:\app_path\file1.pdf
P_NAME2 = c:\app_path\file2.pdf

MESSAGEBOX(P_NAME1, 64, "First file name parameter path")
MESSAGEBOX(P_NAME2, 64, "Second file name parameter path")
AV1.Open("&P_NAME2","Individual Asset Summary")
PD1 = AV1.GetPDDoc()

AV2.Open("&P_NAME1","Table of Contents")
PD2 = AV2.GetPDDoc()

PD1.InsertPages(PD1.GetNumPages()-1, PD2, 0, PD2.GetNumPages(), .F.)

AV2.Close(.T.)
RETURN .T.

Do this is where I am at now.

I can do this with no problem in VB, but my application is VFP and I need to make sure I have the correct OLE code I am guessing.

Art Art DeGaetano II
Software Developer, MOUS
 
AV1.Open("&P_NAME2","Individual Asset Summary")

the above appears to be wrong
change "&P_NAME2" to P_NAME2 Attitude is Everything
 
yes, but dont you need the quotes just in case it is a long file name?

IE c:\some location\some dir\my file.pdf

I thought the PDF writer rejects the file since it cannot see it because of the spaces. That is why the quotes. At least that was the response I got from the guy who wrote the function a long time ago.

Art Art DeGaetano II
Software Developer, MOUS
 
that may be a possibilty. there are commands in fox that do not handle long file names very well while others do.
so if this has been tested that it requires the quotes it is used correctly.

I havn't used PDF in quite a while, so I can't spot anything. if you can I suggest that you try this manually at the server. Attitude is Everything
 
Yeah I may have to try the server approach. Even without the " " I still do not get what I am looking for.

I will have to keep trying until I get this. It is funny, distiller works with no problem, just the PDFWriter is my problem.

Art Art DeGaetano II
Software Developer, MOUS
 
ClayTech

[i}I will have to keep trying until I get this. It is funny, distiller works with no problem, just the PDFWriter is my problem.[/i]

Just to let you know, we have the same setup on our NT4 server (Citrix, VFP app on the server, Adobe Acrobat full version) and I have the whole thing working properly under Adobe 4, but under Adobe 5 (maybe a bad install or not admin rights or something), but I too can only get the distiller to work properly. The users got use to it, so I stopped investigating. But I rememeber a reference to looking for a file in the indvidual user's profile (on the server itself). But it definately does not look for a file on the user's PC.
Mike Gagnon
 
OK now when I try to see what CITRIX is doing, I decided to change the code to prompt for a printer. When I choose PDFwriter as my printer, (not the PDFWriter that is shared from my client machine), i get this in the NT server monitor log

1168 11:16:18 AM CSRSS.EXE:3448 IRP_MJ_CREATE M:\Program Files\Adobe\Acrobat 4.0\PDF Output\*.pdf NAME INVALID Attributes: N Options: OpenIf

The name invalid is what is getting me. my network admin have this setup properly, I am just confused to why the name is invalid. We even have that directory available for all users to write to as well.

Guess I have to keep trying something.

Art Art DeGaetano II
Software Developer, MOUS
 
ClayTech
1168 11:16:18 AM CSRSS.EXE:3448 IRP_MJ_CREATE M:\Program Files\Adobe\Acrobat 4.0\PDF Output\*.pdf NAME INVALID Attributes: N Options: OpenIf

That was pretty much the message I was getting. It seem to say the "*.pdf" file name is an invalid one, which I can agree to that, but I never got the prompt to allow me to put a nem in the first place.

Mike Gagnon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top