odt sample_from aspose webstie.zip (13.3 KB)
Hello Aspose Support Team,
We are experiencing an issue with ODT to PDF conversion where the paragraph formatting in the output PDF does not match the original ODT file.
We tested this using:
Both methods produce similar results, but the formatting in the generated PDF is not consistent with the original ODT file (especially in the paragraph sections).
Steps to Reproduce:
- Use the attached
sample.odt
file as the input.
- Run the following code snippet in a .NET 8 environment (Docker container):
Aspose.Words.Document wDoc = new Aspose.Words.Document(inStream);
pageCountDocument = wDoc.PageCount.ToString();
wDoc.Save(outStream, Aspose.Words.SaveFormat.Pdf);
- Compare the output PDF (
output.pdf
) with the original ODT file.
Observed Behavior:
- The output PDF does not preserve the paragraph formatting as expected.
- The results are identical when using both our local conversion (via .NET 8 in Docker) and the Aspose online conversion tool.
Expected Behavior:
- The PDF output should match the original ODT formatting (especially for paragraph alignment, spacing, and text flow).
Environment Details:
- Aspose.Words version: (please fill in the exact version you are using)
- Runtime: .NET 8
- Deployment: Docker container
- OS: (e.g., Linux Ubuntu 22.04 or Windows Server)
Attachments:
sample.odt
(original document)
output.pdf
(generated using code above)
Additional Notes:
We suspect this could be related to a command or formatting interpretation issue during the conversion process.
Kindly review and advise on a possible fix or workaround.
Thank you!
odt sample 2_Converted from Framework 8.pdf (11.2 KB)
@tarangtbs
It seems you’re experiencing issues with paragraph formatting when converting ODT files to PDF using Aspose.Words in a .NET 8 environment. Here are some suggestions to help address the formatting discrepancies:
-
Check Aspose.Words Version: Ensure you are using the latest version of Aspose.Words, as updates often include bug fixes and improvements related to document conversion.
-
Load Options: When loading the ODT file, consider using OdtLoadOptions
to specify any particular settings that might help with formatting. For example:
OdtLoadOptions loadOptions = new OdtLoadOptions();
Aspose.Words.Document wDoc = new Aspose.Words.Document(inStream, loadOptions);
-
PDF Save Options: You can specify PdfSaveOptions
to control how the PDF is generated, which may help preserve formatting:
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.EmbedFullFonts = true; // Ensure fonts are embedded
wDoc.Save(outStream, pdfSaveOptions);
-
Testing with Different Settings: Experiment with various settings in PdfSaveOptions
, such as PageSize
or TextCompression
, to see if they affect the output.
-
Review the Original ODT File: Sometimes, the issue may stem from the original ODT file’s formatting. Ensure that the styles and formatting are correctly applied in the ODT document.
-
Use Aspose Support: If the issue persists, consider reaching out to Aspose support with detailed information about the problem, including the specific version of Aspose.Words you are using and any relevant code snippets.
By following these steps, you should be able to improve the formatting consistency between the original ODT file and the generated PDF. If you need further assistance, feel free to ask!
@tarangtbs Unfortunately, I cannot see the problematic input ODT document in the attachments. Could you please attach your problematic input document here for testing? We will check the issue and provide you more information.