I am searching for a way to add several files into one file, much like a Zip file. I need to be able to create a file container on the fly and add several word documents, images and other important files into the container. My criteria is that you don't need to install any additional software on the computer (preferebly only a .DLL file that i can include in my project), that the program is free and that you can encrypt the data.
Anyone know of any good container programs that has support for these 2 criterias or if anyone know any good information about how to create your own container.
Patrick
Does it have to be like a zip file, or can it be a zip file?
Are you using .NET Framework 3.0 or 3.5? If so, look at
System.IO.Packaging.ZipPackage
This discussion has a section about it.
In addition to DotNetZip (licensed with Microsoft Public License) that Jay Riggs mentions, there's SharpZipLib (licensed with GPL). Whichever you choose, be sure the terms of the license match your understanding of the word "free".
If you can use ZipPackage, one benefit is that you don't need to think about license terms (beyond those of developing any other .NET app).
EDIT: DotNetZip and SharpZipLib support encryption. I don't see that ZipPackage does, but you could look at System.IO.Packaging.EncryptedPackageEnvelope.
I used DotNetZip in a project and it worked really well. I would recommend using it. It supports encryption and is easy to use.
http://www.codeplex.com/DotNetZip
User .Net GZipStream class(System.IO.Compression namespace.) to compress and decompress files. You can find more information on
MSDN Link
GZIP Compression
I have personally used this technique to decomress .zip file. Click Here
Related
Looking for suggestions for libraries that can generate PDF and RTF documents from stored data (not "HTML to PDF" or "URL to PDF"). With all functionality for adding images, encryption etc. We are currently looking for an alternative to PDFSharp-MigraDoc-GDI, which, although works with .NET Core, does not fully support it and we see compiler warnings - "This package may not be compatible with your project". We have also been getting issues on the IIS tier regarding GDI+. We've decided to play it safe and find an alternative. Does anyone have a solution that they would recommend? Thanks
As far as I know, you can write whole new documents using the Microsoft.Office.Interop library, here is this post that's talk about it (be careful about deploying things like these, you might need an office instalation running on the server):
https://www.c-sharpcorner.com/UploadFile/muralidharan.d/how-to-create-word-document-using-C-Sharp/
And I've found this post about using the library to print PDFs:
How do I convert Word files to PDF programmatically?
It's not much but hope that it helps, regards!
Im looking for methods to combine files including their name and relative path into one single file. A folder disguised as a file. I don't need any compression or encryption. Just the file data including some binary metadata attached to each file.
It would be great if this file was possible to open/inspect/unpack with a standard file browser in Windows such as with regular zip-files.
Yes I could use zip. But I'm researching alternatives and I would prefer a simple method I could implement myself in C#/.NET.
UPDATE
I've researched this some more and came across Microsoft's Structured Storage format. It looked promising at first but it seemes to be an obsolete format, replaced with the Open Package Format. And then I found out about the TAR-format. It seemes to be the most basic format. But I'm not sure yet if I can add any custom metadata to the entries with TAR.
UPDATE
I went with DotNetZip at the end anyway...
Why not use zip? You can use a third party library, like dotnetzip, to make the code easy to write. And, as you mentioned, Windows handles zip files well.
If you have specific reason to search an alternative to ZIP, take a look on virtual file systems, eg. CodeBase File System or our Solid File System. Solid File System lets you add alternate data streams (like in NTFS) or tags (small chunks of binary or text data) to each file or directory. And with OS edition of SolFS you can make the filesystem visible to Windows (including Explorer and third-party applications).
I must admit that while virtual file systems are easy to use (easier than ZIP), they are commercial products (I didn't see free virtual file system implementations yet).
What is the best way to convert a whole folder (including it's contents) into a .zip file?
There is no class for doing this in the .NET Framework itself, but you can use some of the third-party libraries. An open-source DotNetZip seems to be quite good and has a lot of examples to get you started. You'll just need to recursively iterate over all files in the given folder and add them one by one.
This appears to have your answer.
I've used the Xceed Zip libraries in the past for this and found them very easy to use. The full license is quite pricey, but they do have a 45 day, 100% functional free trial available here:
http://xceed.com/Zip_Net_Intro.html
I want to compress and decompress a folder using C#. The problem with GZipStream is that it takes filenames and hence I need to write a recursive logic.
Can I somehow do it like, give source folder name and destination filename to compress the complete folder with hierarchy. I need to do vice-versa for de-compressing the folder as well.
If its not possible through C#/.net directly please suggest some Free 3rd party.
I've used the free SharpZipLib multiple times and I'd recommend that you take a look at it. It's quite easy to use and have worked well for all my use cases.
Now included in .NET 4.5 if you'd rather stay off non microsoft libs.
System.IO.Compression.ZipArchive Class
GZip only ever deals with single files, which is why under *nix you end up having to archive them into a TAR file first which is then compressed.
If you want multiple files/folders you'll need a format which supports it, like ZIP.
You might want to thus look at: http://www.sharpdevelop.net/OpenSource/SharpZipLib/
You could take a look at this library instead.
Take a look at DotNetZip Lib.
I need to programatically highlight PDFs on the fly, preferrably using the highlight file method.
Are there any .net programming libraries to generate a xml highlight offsets file for a pdf? Doesnt have to be open source or free.
I tried converting PDFBox to a .net DLL using IKVM and it did not work correctly. Im not terribly excited about the memory footprint of the entire java class library in the DLL anyway.
a second option would be to regenerate and highlight the source PDF, if there are any libraries / APIs that will do this to a PDF relatively easily that would work too, but I have not found any in my searches.
thanks in advance.
I dont know if this has solution for your requirement, but this is a good opensource api to work with PDF. I will be so happy if it could help your needs.
http://itextsharp.sourceforge.net/tutorial/index.html