Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to delete PDF files after viewing
Message
From
30/03/2007 10:54:20
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
28/03/2007 11:36:39
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01209270
Message ID:
01210368
Views:
13
Andrus,

How about deleting the files before instead of after a viewing? I.E. delete all "*.pdf" (that are not currently open) in the folder before displaying the current pdf.

- Keith

>I'm trying to use the the following code to show pdf or xls file generated by ReportViewer.
>After application closes, temporary files remain in disk.
>
>How to delete PDF files after Adobe Reader is closed ?
>Is the best way to save files passed to external application to temporary directory and delete whole directory if application exits or use filewatcher?
>Any sample how to implement this ?
>
>
void ShowPDF( byte[] bytes ) {
>static int i=0;
>string outputfile = "temp"+(i++).ToString()+".pdf";
>FileStream fs = new FileStream(outputFile, FileMode.Create);
>fs.Write(bytes, 0, bytes.Length);
>fs.Close();
>System.Diagnostics.Process p = new System.Diagnostics.Process();
>p = new System.Diagnostics.Process();
>
>p.StartInfo.FileName = outputFile;
>p.Start();
>}
Previous
Reply
Map
View

Click here to load this message in the networking platform