0

How to download PDDocument for example, PDDocument has has 10 pages with document name as Test and now this has to downloaded as zip file inside should PDF doc as Test1, Test2... Test10 in a zip file named Test.zip.

ByteArrayOutputStream bytestream=new ByteArrayOutputStream()
PDDocument doc = new PDDocument();
Splitter splitter = new Splitter();
//I can do this splitting of each page as PDDocument
List<PDDocument> splitDocs = splitter.split(doc);

doc.save(bytestream);
doc.close()

return bytestream;
Shan
  • 65
  • 7
  • Please clarify your question. Do you want to PUT your 10 result files into a new ZIP file? Then see e.g. https://stackoverflow.com/a/8337985/535646 Or is your source PDF in a ZIP file? And why are you splitting an empty document? – Tilman Hausherr Dec 11 '18 at 08:21
  • 1
    @TilmanHausherr Yes I want to put 10 result files which I generated dynamically from a single document which I get as (List). After getting how to proceed with byestream ? – Shan Dec 11 '18 at 08:50
  • 1
    You can save() the splitted documents into a ZipOutputStream as shown in the link. – Tilman Hausherr Dec 11 '18 at 09:11

0 Answers0