Forum


Replies: 1   Views: 1101
Multiple docx documents in a zip file
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 25-03-2021 - 17:11

Hello,

phpdocx Premium licenses can generate a DOCX as a stream using the included ZipStream class, but this class doesn't allow adding streams to generate a new ZIP file that includes them (ZipStream uses gzcompress that doesn't allow adding streams/objects). phpdocx doesn't include a class to generate a ZIP stream that include DOCX streams.

PHP ZipArchive doesn't support adding streams (only files and strings), so an external library or tool should be used.  Maybe ZipStream-PHP (https://github.com/maennchen/ZipStream-PHP) is a good solution, you can generate DOCX streams using phpdocx and using that library you could generate a new ZIP from these strings. Or you can use a RAM disk (https://www.jamescoyle.net/how-to/943-create-a-ram-disk-in-linux) to avoid generating the DOCX in the filesystem.

Regards.