on 04-06-2020 12:57 AM
I want to Zip pdf files (which are stored in a table as blob objects) and return it to the UI5 application.
In XS Classic you can use the $.util.Zip library. In the XSJS compatibility mode of XS Advanced you can use that library too, but there are more better Node alternatives. But according to your other questions here I think you are working with XSc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Florian,
I am trying to do something like this:
query: select document,title from table where id in [1,2,3..];
var zip =new $.util.Zip();
var folderName="test";
while(resultSet.next()){
zip[folderName+"/"+resultSet.getString(2)+".pdf"]=resultSet.getBlob(1);
}
$.response.setBody(zip);
$.response.setContentType("application/zip");
(Its not the complete code but I am doing something like this)
I want the output to be of something like below: my zip folder contains a folder "test" which contains my "pdf" files.
But when I open the generated zip it displays Invalid zip format. I don't think that pdf's are being zipped inside a folder. Am I missing something?
Can you show your whole coding which is related to the zip file creation. What I miss is that you set the body of the response as array buffer of the zip object.
The settings regarding the "folder creation" look ok.
Maybe you try to replace the setting of the PDF blob to the zip by a simple string to test in a first step if the zipping in general works. Then it can be checked by the blob value is probably not correctly zipped.
User | Count |
---|---|
85 | |
11 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.