Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET How do I use a template, add other files, zip, and download?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19847 |

    Ok, I am hoping something can tell me how to do this. Basically, I have an HTML page with some images on my server. When I use clicks on a download button, what I need to do is:

    1) Open the HTML page and change some of the text for that customer and keep it in memory
    2) Add the HTML page in memory to a zip in memory
    3) Add static images from a folder on the server to the zip in memory
    4) Produce a link then to the zip file in memory that now as the customers custom HTML file and images.

    I can do that dynamic changing of the HTML page, but that is about where I get stuck. I really don’t understand how to do things in memory, add to a zip in memory, and produce then a link for download to the customer. If this were just writing to disk each time I could do it, but it seems from what I have read I should be able to do it in memory.

    I am using it with ASP.NET VB.NET, but I do C# too. So if anyone has any suggestions, I would really appreciate it!

    HW

    Imported from legacy forums. Posted by Heavy (had 2255 views)

    Xceed Support
    Member
    Post count: 5658

    You can handle all the zipping part in memory. But the link needs to reference a DiskFile.

    This snippet of code should be able to guide you:

    //You create a reference to your HTML page:
    StreamFile HTMLpage = new StreamFile( streamOfTheHTMLPage );

    //Add HTML to MemoryZip:
    AbstractFile zipFile = new MemoryFile();
    ZipArchive zipArchive = new ZipArchive( zipFile );
    HTMLpage.CopyTo( zipArchive, true );

    //Add images to Zip
    AbstractFile imageFile = new DiskFile( “PathToImageFile” );
    imageFile.CopyTo( zipArchive, true );

    //Put the Zip file on disk for a link
    AbstractFile zipOnDisk = new DiskFile( “PathToLink” );
    zipFile.CopyTo( zipOnDisk, true );

    Imported from legacy forums. Posted by CharlesB (had 3114 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.