Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI

I developed an C# application that dynamically creates and opens a newly created .pdf file using Adobe Reader X(Which is my default .pdf reader).

...

//Creating the file
Document.CreateFile(FileName);

//Opening the file
System.Diagnostics.Process.Start(Filename);

...
//File name is the path where the .pdf file is created and stored(Which is the debug folder of my project).

The above code works perfectly in Visual Studio 2010 but not once the project is deployed.
When running the installed project neither does it create the .pdf nor does it opens .pdf.

Please help ????
Posted

We can't answer that - there are far too many ways that something like this could go wrong. For example, the target computer may not have any file association for PDF files which would prevent them opening. We can't tell - you will have to check.

However, the most likely problem is that you are storing the files in the wrong folder. If you try to keep them in the application folder, or a folder that is inside the application folder, then production code will generally fail as the user does not have the required permissions to access it. (ignoring that it's a silly idea to start with) It works in development, because your app is running under your user and you have access to your application folder (or you couldn't compile a new version) but move it to production, and your are talking about "Program Files/MyApp/xx.pdf" and you haven't got permission.

See here: Where should I store my data?[^] - it suggests some safe places, and shows how to use them.
 
Share this answer
 
Comments
AndreEsau 25-Nov-13 15:41pm    
Okay I followed and read the link "Where should I store my data". I took the last example (the one you preferred) and again it works perfectly in development but not from my installed project.

I verified that the .pdf file is actually created and stored :( C:\Users\pOki pAc\AppData\Local\{BC184886-E9F7-4357-BAE8-B679B2753F0C} ). But as I said all of this is only happening during development. After installing the project nothing happens... ??
OriginalGriff 26-Nov-13 4:48am    
This may sound like a silly question, but...
Is this a website application?
AndreEsau 26-Nov-13 6:44am    
No... a winform application.
OriginalGriff 26-Nov-13 6:51am    
Good! (website would make it impossible, because the server can't access client files)
What error do you get when it tries?
What is the value of FileName immediately before each of the calls? Does that exact file / path exist on the production PC?
Hey

I found my problem. It appears that there is a compatibility issue with either my program or with Windows 8 because it runs as expected on Windows 7 but not Windows 8.

Thank you very much for your time, effort and help.
 
Share this answer
 
Quote:
System.Diagnostics.Process.Start(Filename);
This code will open it on the server. It will not open it on the client. An easy way to get it to open on the client is to use Response.Redirect(url) or use the Response object and stream the pdf to it.

You're likely getting a permissions issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900