0

in a project asp.net, I generate invoices with active reports and I save them in pdf format. there I want to create a zip file dynamically and add the pdf invoices then downloading this file zip in client side. help me please.

3
  • look here to create zip files in asp.net & here to download files. Commented May 21, 2018 at 3:52
  • I tried the code but I have an error on the zipFilename variable on the line: using (Package zip = System.IO.Packaging.Package.Open(zipFilename, FileMode.OpenOrCreate)) "Access to the path 'C:\Program Files (x86)\IIS Express\Output.zip' is denied." Commented May 21, 2018 at 19:31
  • manually give a path to zip file Commented May 21, 2018 at 23:48

1 Answer 1

0
        string zipFileName = "a.zip"; 
        using (var zip = new ZipFile())
        {
            System.IO.File.Delete(fileDir + "/" + zipFileName);
            zip.AddDirectory(fileDir + "/");
            zip.CompressionLevel = CompressionLevel.Level5;
            zip.CompressionMethod = CompressionMethod.BZip2;
            zip.Save(fileDir + "/" + zipFileName);
        }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.