aspose-words / Aspose.Words-for-Java

Aspose.Words for Java examples, plugins and showcases
https://products.aspose.com/words/java
MIT License
403 stars 206 forks source link

How can I convert .doc in .docx #108

Open KatRRina opened 5 months ago

KatRRina commented 5 months ago

I use this code:

public DocumentDto parseDocument(byte[] docBytes){
        try {
            ByteArrayInputStream docStream = new ByteArrayInputStream(docBytes);
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

            Document doc = new Document(docStream);
            doc.updateWordCount();
            doc.save(outputStream, SaveFormat.DOCX);
            // Получаем массив байт из ByteArrayOutputStream
            byte[] resultBytes = outputStream.toByteArray();
            DocxParser docxParser = new DocxParser();
            DocumentDto result = docxParser.parseDocument(resultBytes);
            result.setFormat(getDocumentType());
            docStream.close();
            outputStream.close();
            return result;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

but after the line Document doc = new Document(docStream);, there are 7 pages left in the 150-page document

AlexNosk commented 5 months ago

@KatRRina Most likely, this occurs because you are using Aspose.Words in evaluation mode. There two limitations in the free evaluation version of Aspose.Words:

Please see our documentation for more information: https://docs.aspose.com/words/java/licensing/

If you would like to test Aspose.Words without evaluation version limitations, you can request a free 30-days temporary license .

KatRRina commented 5 months ago

@KatRRina Most likely, this occurs because you are using Aspose.Words in evaluation mode. There two limitations in the free evaluation version of Aspose.Words:

  • An evaluation watermark is injected in the documents.
  • The maximum size of the processed document is limited to several hundreds of paragraphs.

Please see our documentation for more information: https://docs.aspose.com/words/java/licensing/

If you would like to test Aspose.Words without evaluation version limitations, you can request a free 30-days temporary license .

Thank you!