White spaces appears as boxes in PDF


I am inserting an RTF document content using

DocumentBuilder.insertDocument(srcDoc, importFormatMode) and

saving it in DOCX & PDF format


The DOCX document shows the RTF content correctly but the PDF document shows a box in place of every white spaces.

Is there any way to treat the boxes appearing in place of white spaces to appear correctly ? Is there any other API to insert the RTF document and save it to PDF ?

Prabhaker Kr.

Hi Prabhaker,

Thanks for your inquriy. It seems you are using Aspose.Words for the RTF to DOCX/PDF conversion, so I am moving your post to the related forum. My colleagues from Aspose.Words will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Hi Prabhaker,

Thanks for your inquiry. Could you please attach your input Word and Rtf documents here for testing? We will investigate the issue on our side and provide you more information.

Hi Tilal,

Thank you for the reply. I have attached the RTF document in which I am getting the issue.

You can use any DOCX document to insert the content from the attached RTF document. After inserting the RTF into DOCX file, save the final document to a PDF also. The PDF document replaces the white spaces to boxes.

Thanks & regards,
Prabhaker Kr.

Hi Prabhaker,

Thanks for sharing the detail. We have tested the scenario using latest version of Aspose.Words for Java 15.12.0 with following code example and have not found the shared issue. Please use Aspose.Words for Java 15.12.0. Please check the attached input docx and output Pdf.

Document rtf = new Document(MyDir + "Regulations_part7.rtf");
Document docDocx = new Document(MyDir + "in.docx");
DocumentBuilder builder = new DocumentBuilder(docDocx);
builder.insertDocument(rtf, ImportFormatMode.KEEP_SOURCE_FORMATTING);
docDocx.save(MyDir + "Out.pdf");

Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts on the machine where you’re converting documents to Pdf. Please refer to the following articles:

How Aspose.Words Uses True Type Fonts
How to Specify True Type Fonts Location
How to Receive Notification of Missing Fonts and Font Substitution during Rendering