473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How Can I open a Exsting PDF File

390 Expert 256MB
Hi,

Is there any way I can open the exiting PDF file by clicking a button on my c#.net application.
Please note I have acrobat reader installed on my machine.
Sep 27 '07 #1
8 1332
kenobewan
4,871 Expert 4TB
Yes there is a way, suggest try search the site for clues.
Sep 27 '07 #2
Plater
7,872 Expert 4TB
Look at the Proccess class.
You should be able to set ShellExecute = true; then pass in the path+filename of the pdf to run it
Sep 27 '07 #3
mzmishra
390 Expert 256MB
Thanks Plater.
Can you please send me the code sample .
Sep 28 '07 #4
mzmishra
390 Expert 256MB
Thanks Platter.
Actually my application is a asp.net application whch is in webfarm.
I have written a function to open the existing file,but it did not do anything,no error message nothing.Please review the code if I am doing anything wrong.

private void OpenFile()
{
Process myProcess = new Process();

try
{
// Get the path that stores user documents.
//string myDocumentsPath = Environment.GetFolderPath(Environment.SpecialFolde r.Personal);
string myDocumentsPath=@"c:\new.pdf";

myProcess.StartInfo.FileName = myDocumentsPath ;
myProcess.StartInfo.Verb = "Print";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
}
catch(Exception ex)
{
throw ex;
}
}
Oct 1 '07 #6
Plater
7,872 Expert 4TB
Ahhh, well that will try and open it on the server computer, not locally.

Is the pdf located on the client computer, or on the server?
Oct 1 '07 #7
mzmishra
390 Expert 256MB
Thanks Plater for your help.

Actually I am creating the PDF file in a server /webfarm.
and after creating it I am trying to open it locally.

I have used this code now and it is working for me

Response.ContentType = "application/pdf";
string filePath="path.pdf" Response.WriteFile(filePath);
Oct 4 '07 #8
Shashi Sadasivan
1,435 Expert 1GB
look into allowing a user to download from asp .net

you will have to stream the file for the user to download it.
I think you can force it to only open it rather than save it.

but opening will save it in the cache anyways.

cheers
Oct 4 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: yanivmad | last post by:
hi I like to ask if there any option to control the html files?!? I have some HTML files at my web site that use one "Help.htm" file for all the pages {I use the "window.open(.... " option at...
9
by: Charles F McDevitt | last post by:
I'm trying to upgrade some old code that used old iostreams. At one place in the code, I have a path/filename in a wchar_t string (unicode utf-16). I need to open an ifstream to that file. ...
2
by: Jonathan Trevor | last post by:
Hi, For the last couple of releases of a product we're developing we've been running to very wierd behavior from IE and our ASP.NET web application which serves up various types of files and I'm...
6
by: Dino Buljubasic | last post by:
My application creates some temporary files that are deleted when my application terminates. However, if a temp file is open, it will not be deleted and application will crash. How can I...
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
6
by: Brad | last post by:
I have a win2003 server workstation with multiple webs, each web has it's own ip address. In VS2005, if I select to open an existing web site, select Local IIS, the dialog correctly displays a...
6
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
6
by: Moumen VB.NET 2003/2005 Developer | last post by:
How can I detect if a file sitting on a network drive is still open by another application? This application resides on another machine on the network? I am using VB.NET 2003 Your help is...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.