We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get Correct Number of Pages form LibreOffice DOCX containing a Big Footnote using Java

Hi,

I have an issue with a file with a huge footnote that cannot fit in the dedicated area. If I open it with LibreOffice, it appears as a single page with the footnote that have been truncated as I would expect since the content of my document is only composed of 3 lines in one single page without any page breaks. If I open it with Aspose even with or without a valid license, my file is actually split into several pages, one page per line so instead of having one single page, I end up with a file with 3 pages instead of one.

Here is a unit test showing the issue that I have:

@Test
public void should_truncate_huge_footer_to_avoid_unexpected_page_count() throws Exception {
    try (InputStream input = new FileInputStream("/path/to/my/file/Test1-Word2007-365.docx")) {
        Document doc = AsposeBuilder.getDocument(input);
        assertEquals(1, doc.getPageCount());
    }
}

Please find as attached file into the zip, the file that causes the issue:

Test1-Word2007-365.docx.zip (97.3 KB)

Thank you in advance for any help,
BR,
Nicolas

@essobedo,

We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-20256. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

@awais.hafeez thank you for the quick answer and for creating a ticket for it, I hope that it is not too hard to fix.

@essobedo,

We will inform you via this thread as soon as this issue will be resolved in future. We apologize for any inconvenience.

@essobedo,

Regarding WORDSNET-20256, it is to update you that Aspose.Words makes the same PDF as MS Word does. There are three pages, not a single one in the MS Word desktop application and in the PDF. But, if we save the document as DOC, then there will be only one page. It seems LibreOffice uses the ‘old’ layout rules. If you want the same layout as in the LibreOffice and DOC then you need to save/open original document. But anyway, Aspose.Words produces the same PDF as MS Word.

string MyDir = @"d:\Aspose\april\20256\";

Document doc = new Document(MyDir + "input.docx");
doc.Save(MyDir + "output aw 3 pages.pdf");

using (MemoryStream ms = new MemoryStream())
{
    doc.Save(ms, SaveFormat.Doc);
    Document resavedDoc = new Document(ms);
    resavedDoc.Save(MyDir + "output aw 1 page.pdf");
}

Hope, this helps.