Thanks for your reply.
I did not use any word document as an input.
I got the document from opening an URL of a form, and then convert it to Document Object.
Here is the code :
URL url = new URL(“http://oa.ptpjb.com/” + paramDb + “/0/” + paramDocUNID + "?OpenDocument);
URLConnection webClient = url.openConnection();
URLConnection webClient = url.openConnection();
InputStream inputStream = webClient.getInputStream();
int pos;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
while ((pos = inputStream.read()) != -1)
bos.write(pos);
byte[] dataBytes = bos.toByteArray();
ByteArrayInputStream byteStream = new ByteArrayInputStream(dataBytes);
LoadOptions loadOptions = new LoadOptions();
Document doc = new Document(byteStream,loadOptions);
LayoutCollector layoutCollector = new LayoutCollector(doc);
doc.updatePageLayout();
DocumentPageSplitter splitter = new DocumentPageSplitter(layoutCollector);
Document pageDoc = splitter.GetDocumentOfPage(2);
response.setContentType(“application/vnd.ms-word”);
response.setHeader(“content-disposition”, “inline; filename=” + paramFileName);
ServletOutputStream outputStream = response.getOutputStream();
pageDoc.save(outputStream, SaveFormat.DOCX);
Is there a way to split the document that is imported by opening an URL ?
Best Regards