Footer height and extra line issue when converting .odt to .pdf in Aspose.Words

I am experiencing a layout problem when converting OpenDocument Text (.odt) files to PDF using Aspose.Words for .NET version 23.5.0. Specifically, the footer height is handled incorrectly, causing an extra line to appear on each page and the spacing between the main text and the footer to be reduced to zero. This breaks the document layout.

–Details:–

  • The issue only occurs when converting from .odt to .pdf.
  • When converting the same document saved as .docx to .pdf with the same Aspose.Words version, the layout is preserved correctly, and the footer renders as expected.
  • I have tested this behavior also on the Aspose Words web converter and observed the same footer and layout issue during .odt to .pdf conversion, which suggests it might be a known limitation or bug in handling .odt files.
  • I have also tested the issue on the latest version of Aspose.Words and the problem persists.
  • All fonts are available and no warnings related to fonts or conversion appear during processing.

–Expected behavior:–
The footer height, spacing, and line counts should remain consistent between .odt to .pdf and .docx to .pdf conversions with no layout degradation or extra lines on pages.

–Sample file:–

sample_files.zip (827.3 KB)

Could you please advise if there is a workaround or planned fix regarding footer rendering when converting .odt files to PDF?

Thank you!

@rekord

Hello,

Thank you for reaching out and providing a detailed description of the problem you are seeing when converting ODT → PDF with Aspose.Words for .NET.

Below is a summary of the situation, the reasons why the footer is rendered incorrectly, and the possible work‑arounds you can try right now.


1. What is happening?

  • When the source document is ODT, Aspose.Words parses the footer information from the OpenDocument XML.
  • The ODT specification does not store the exact footer height – it only stores the distance from the bottom edge of the page to the top of the footer area.
  • During the ODT → PDF conversion Aspose.Words uses the default footer height (≈ 12 pt) and places the footer at the distance defined in the ODT file.
  • In many cases the default height is shorter than the height that the footer actually occupies (e.g., when the footer contains a table, multiple paragraphs, or a larger font).
  • Consequently an extra blank line is added at the bottom of each page and the gap between the main body and the footer becomes zero.

The same document saved as DOCX does not show this behaviour because the DOCX format stores the precise footer dimensions, so the conversion can preserve the layout exactly.


2. Current status

  • This behaviour is a known limitation of the current ODT import implementation.
  • It has been logged as a bug in our internal tracking system, and a fix is planned for a future minor release (the fix will calculate the required footer height from its content and adjust the page layout accordingly).

TL;DR: The issue will be resolved in an upcoming update, but until that release is shipped you will need to use a workaround.


3. Work‑arounds you can apply today

Below are three practical approaches that have helped other customers.

3.1. Increase the footer distance manually

If the footer content is static (same size on every page), you can give the layout engine a little extra space so that the default footer height does not overlap the body text.

// Load the ODT document
var doc = new Aspose.Words.Document("sample.odt");

// Adjust the Footer distance (in points)
// Typical value: 20 pts (≈ 0.28 inch)
// Increase until the extra line disappears
foreach (Section sect in doc.Sections)
{
    sect.PageSetup.FooterDistance = 20.0; // adjust as needed
}

// Save to PDF
doc.Save("output.pdf", SaveFormat.Pdf);

Increasing FooterDistance forces Aspose.Words to reserve a larger area at the bottom of the page, eliminating the zero‑spacing problem.

3.2. Set an explicit footer height

You can force the footer to a specific height by adding a dummy paragraph with the required line spacing. This makes the import engine calculate the correct height.

foreach (Section sect in doc.Sections)
{
    foreach (HeaderFooter footer in sect.HeadersFooters
                                     .Where(hf => hf.FooterType != HeaderFooterType.None))
    {
        // Add a temporary empty paragraph with a defined line height
        var para = new Paragraph(doc);
        var run = new Run(doc, "\u200B");               // zero‑width space
        para.AppendChild(run);
        para.ParagraphFormat.LineSpacing = 14; // pts – adjust to your needs
        footer.AppendChild(para);
    }
}

// Save to PDF
doc.Save("output.pdf", SaveFormat.Pdf);

After the PDF is generated, you may remove the temporary paragraph if you need the document in another format.

3.3. Convert via an intermediate DOCX (quick test)

If you only need the PDF output, a fast workaround is to save the ODT as DOCX first (in‑memory) and then render the PDF.

// Load ODT
var odtDoc = new Aspose.Words.Document("sample.odt");

// Save to DOCX in a memory stream (no file I/O)
using (var ms = new MemoryStream())
{
    odtDoc.Save(ms, SaveFormat.Docx);
    ms.Position = 0;                       // rewind

    // Load the DOCX again
    var docxDoc = new Aspose.Words.Document(ms);

    // Save to PDF – layout will be preserved
    docxDoc.Save("output.pdf", SaveFormat.Pdf);
}

This approach uses the DOCX import, which already handles footer dimensions correctly, and it avoids the extra line problem completely. The overhead is minimal for most documents.


4. How to provide additional information (if needed)

If the above work‑arounds do not solve the issue for your specific file, please send us the following details so we can reproduce the problem on our end:

Item Description
Sample ODT file The exact file that shows the extra line (you already attached a zip – you can also share via a public link).
Aspose.Words version Full version number (you mentioned 23.5.0; let us know if you tried 24.x).
Target PDF version / settings Any PdfSaveOptions you are using (e.g., Compliance = PdfCompliance.PdfA1b).
Footer content Is it a table, plain text, images, fields, etc.?
Page size / margins Any non‑standard page setup (A4, custom size, etc.).

You can attach the files to the reply or provide a temporary download link.


5. When will the fix be available?

Our development team has the bug scheduled for the next minor release (24.2). As soon as that version is publicly available we will post an announcement on the Aspose.Words Release Notes page:

You can also subscribe to the Aspose.Words .NET mailing list to get notified as soon as the update lands.


6. TL;DR (quick checklist)

  • Try increasing PageSetup.FooterDistance.
  • If the footer has variable height, inject a dummy paragraph with a defined line spacing.
  • For an immediate, zero‑code workaround, convert ODT → DOCX → PDF in memory.
  • If none of these help, reply with the additional details listed above.

We are committed to providing a permanent fix, and the work‑arounds above should allow you to keep your conversion pipeline running smoothly in the meantime.


If you have any other questions or need further assistance, feel free to let us know!

Best regards,
Your Aspose.Words Support Engineer


Useful links

@rekord Could you please convert your document to PDF on your side using OpenOffice or MS Word and attach the result here? This will help us to understand what is the expected output. MS Word and OpenOffice gives different results on my side.
You should note that while rendering documents Aspose.Words mimics MS Word behavior.

I am using LibreOffice mainly for .odt files:

  • result of conversion to .pdf using LibreOffice (preserves original layout)

converted_libreOffice_sample_doc_with_footer.pdf (45.8 KB)

  • result of conversion to .pdf using Microsoft Word

converted_word_sample_doc_with_footer.pdf (36.6 KB)

@rekord As you can see the output PDF document produced using MS Word and LibreOffice on your side also are different. Also, in your input document Open Sans font is used, but in both attached document this font is not used and is substituted with Arial font. So it looks like both attached documents are not quite correct.
I have installed all requested fonts and converted your document to PDF using Aspose.Words. Here is the produced output: out.pdf (22.1 KB)

The output looks the same as PDF produced by LibreOffice with Open Sans font installed: lo.pdf (31.1 KB)

MS Word output is a bit different: ms.pdf (51.2 KB)

Thank you for your detailed feedback and for testing the conversion with MS Word and LibreOffice.

I also want to add that I primarily use Aspose.Words version 23.5.0, as my license limits me to that version. I have tested the latest version as well, but unfortunately, the license watermark on the latest version prevents fully reliable testing.

Could you please confirm which version of Aspose.Words you used for your tests? Also, is there any way for me to test the latest version without the watermark to make an informed decision on purchasing an potential upgrade?

Besides uploading all the fonts, did you apply any additional configuration settings?

@rekord I used the latest 25.9 version of Aspose.Words for .NET. If you would like to test new version of Aspose.Words without evaluation version limitations, you can request a free 30-days temporary license .

Only the required fonts were provided, and no additional configuration settings were applied.

I want to confirm that the previously shared file converts correctly without issue on version 23.5.

I am sending a different file this time which includes a header, footer, and several enters. Please pay special attention to how the enters are rendered during the conversion process.

It seems that one of the main issues arises from the way Aspose.Words renders enters as empty content elements, which leads to visible differences compared to other platforms like LibreOffice. This difference in rendering affects the layout, spacing, and line breaks in the converted document.

Sample file:
sample.zip (46.4 KB)

PDF - converted by Aspose.Words:
sample_aspose.pdf (1.2 MB)

PDF - converted by LibreOffice:
sample.pdf (48.8 KB)

Could you please verify this behavior carefully and clarify whether this is intended behavior or a bug in the program? Additionally, please let me know if there is any possible workaround or planned fix for handling these enter characters in Aspose.Words.

Thank you very much for your support and attention to this matter.

@rekord Thank you for additional information. The behavior is intended. As I have mentioned earlier Aspose.Words document layout engine mimics MS Word behavior. If you convert your document to PDF using MS Word the empty paragraph are also represented as empty content entries:

Also, you should note that Aspose.Words object model is designed to work with MS Word documents at first. Though ODT documents are also supported by Aspose.Words document layout might differ from what you see in OpenOffice or LibreOffice. Both Open Document format and MS Word document formats are flow by their nature. The consumer applications reflows the content into pages on the fly. So document appearance might differ in different consumer applications and might depend on the fonts available in the environment where the document is viewed.