@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