Aspose words conversion of rtf to pdf does not keep the correct page format and tabular structure

aspose (2).zip (186.3 KB)

The zip file contains the input rtf file and generated output file. Few discrepancies found
1.the content from page 2 in rtf file is showing up on page 1 on pdf.
2. thw boeing images are not on the correct page.
3. the tabular structure in page 4 is distorted
For standard mail, please use: XXXXXXXXXXXXXXXXXX:
XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX
PO Box XXXXX XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX

code:

for (Section section : doc.getSections())
{
    section.getPageSetup().setLeftMargin(ConvertUtil.inchToPoint(0.625));
    section.getPageSetup().setRightMargin(ConvertUtil.inchToPoint(0.625));
    section.getPageSetup().setTopMargin(ConvertUtil.inchToPoint(0.375));
    section.getPageSetup().setBottomMargin(ConvertUtil.inchToPoint(0.875));

    Run addSpacesRun = new Run(doc, ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE + ControlChar.NON_BREAKING_SPACE);

    for (Field f : doc.getRange().getFields())
    {

        if (f.getType() == FieldType.FIELD_FORM_DROP_DOWN && f.getDisplayResult().isEmpty())
            f.getEnd().getParentNode().insertAfter(addSpacesRun.deepClone(true), f.getEnd());
    }
    for (Run run : (Iterable<Run>)doc.getChildNodes(NodeType.RUN, true))
    {

        run.getFont().setHighlightColor(new java.awt.Color(0, true));
        run.getFont().setColor(Color.BLACK);
        // run.getFont().setBold(false);
    }

}
com.aspose.words.PdfSaveOptions options = new com.aspose.words.PdfSaveOptions();
//  options.setEmbedFullFonts(true);
// options.setPreserveFormFields(true);
options.setUpdateSdtContent(true);
options.setCustomPropertiesExport(PdfCustomPropertiesExport.NONE);
options.setExportDocumentStructure(true);
options.setSaveFormat(SaveFormat.PDF);
doc.save(outStream, options);

@ramachandra1988 Page margins are adjusted in your code, so the content of RTF document is reflowed. This is an expected behavior. if convert the document to PDF without modifications, the output look exactly as in MS Word:

Document doc = new Document("C:\\Temp\\in.rtf");
doc.save("C:\\Temp\\out.pdf");

out.pdf (95.7 KB)