1
response.setHeader("Content-Disposition", "attachment; filename=r.pdf");
Document document1 = new Document(PageSize.A4);
PdfWriter pdfWriter=PdfWriter.getInstance(document1, response.getOutputStream());
pdfWriter.setPageEvent(new HeaderAndFooter(name));
try{
document1.open();
XMLWorkerHelper worker1 = XMLWorkerHelper.getInstance();
long seed =123;
Random rnd = new Random (seed);
Collections.shuffle(arrlist1,rnd);
for(int i=0;i<nb;i++){
String str =(String) arrlist1.get(i);
worker1.parseXHtml(pdfWriter, document1, new StringReader(str));
}
}catch(Exception e){e.printStackTrace();}
document1.close();
pdfWriter.flush();
pdfWriter.close();
multi.finish();
%>
我有這個代碼在哪裏創建pdf頁面,我想知道如何壓縮它? 我發現some1的帖子zip使用itext創建的pdf文件
var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
var img = zip.folder("images");
img.file("smile.gif", imgData, {base64: true});
var content = zip.generate();
location.href="data:application/zip;base64,"+content;
這個代碼,但不知道如何把它應用到我的嗎?