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);