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

I am creating a pdf file and want to download it. It is working correctly from my local system.
C#
venderprint pdfForm = new venderprint(GetTable(), Server.MapPath("~/images/logopdf.png"));

            // Create a MigraDoc document
            Document document = pdfForm.CreateDocument();
            document.UseCmykColor = true;

            // Create a renderer for PDF that uses Unicode font encoding
            PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);

            // Set the MigraDoc document
            pdfRenderer.Document = document;


            // Create the PDF document
            pdfRenderer.RenderDocument();

            // Save the PDF document...
            string filename = "VendorInformation.pdf"; 
            pdfRenderer.Save(Server.MapPath("~/File/"+filename));
            Process.Start(Server.MapPath("~/File/" + filename));

This is the code which i am using. The file is storing in File Folder and opening automatically on my local system, but is server the file is storing in File folder but it could not open.
Posted
Updated 4-Sep-13 2:10am
v3
Comments
bbirajdar 3-Sep-13 4:53am
   
not clear
Jimut123456789 3-Sep-13 5:03am
   
means when downloading the pdf file from my local system it is working fine but when upload it to server then it couldn't download.
bbirajdar 3-Sep-13 5:21am
   
I guess you have not written any code for uploading because I cant see any. Please check the upload button event if you have written the code...
[no name] 3-Sep-13 5:03am
   
what do you mean by not working..share more details and also the error you are getting.
phil.o 4-Sep-13 7:46am
   
Maybe there is no application on your server to handle .pdf files...

When you write Process.Start(Server.MapPath("~/File/" + filename));, you tell the server to open the file with the default handler for this file.

But I'm not sure this is what you want (open the generated file on the server). Could it be possible you are trying to open the file on the client from the server?
Dholakiya Ankit 4-Sep-13 8:11am
   
read/write permission of folder checked?

1 solution

most probably it is an issue with permissions, try by sharing that folder and giving write permissions as well
   

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