A white div overlaps the content

Hi,
I have a RTF document, which I am converting to HTML. It gets converted to HTML but there a blank white div is created which overlaps the content.

Can you let me know how this can be fixed?

Version: Aspose.words 16.10.0

Content after turning visibility off of DIV.png (818.7 KB)
HTML content as rendered.png (426.2 KB)
Content showing blank DIV.png (848.7 KB)
Original content.png (133.5 KB)

@subhashlengare,

Thanks for your inquiry. Please ZIP and upload your input RTF document and Aspose.Words generated output HTML file showing the undesired behavior here for testing. We will investigate the issue on our end and provide you more information.

Here is the zip file.

Archive.zip (58.4 KB)

@subhashlengare,

Please also share the source code that you are using to convert this “UPMC_MA_Scout_4253_4053_redacted.rtf” document to HTML format.

private ByteArrayInputStream RTForTEXTorWORDtoHTML(final InputStream docInputStream) throws DocumentConversionProcessException
{
	try
	{
		final long lStartTotalTime = System.currentTimeMillis();
		final Document doc = initDocument(docInputStream);
		final ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
		final HtmlFixedSaveOptions saveOptions = getHTMLSaveOptions();
		doc.save(dstStream, saveOptions);
		final String sDocumentPart = dstStream.toString("UTF-8");
		//s_Logger.info("Document after Aspose");
		//s_Logger.info(sDocumentPart);
		final ByteArrayInputStream srcStream = new ByteArrayInputStream(sDocumentPart.getBytes(Charset.forName("UTF-8")));
		final long lEndTotalTime = System.currentTimeMillis();
		s_Logger.info("RtfTextWord2Html (aspose method) Time: " +(lEndTotalTime-lStartTotalTime));
		return srcStream;
	}
	catch (final Exception e)
	{
		s_Logger.error("Error : "+e.getMessage()+" occured while processing file for pdf conversion", e);
		throw new DocumentConversionProcessException(ERROR_INVALID_DOCUMENT_MODEL,
				Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
				Response.Status.INTERNAL_SERVER_ERROR);
	}
}

/***
 * Getting default save option for converted HTML.
 * @return HtmlFixedSaveOptions
 */
private HtmlFixedSaveOptions getHTMLSaveOptions()
{
	final HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions();
	saveOptions.setExportEmbeddedCss(true);
	saveOptions.setExportEmbeddedFonts(true);
	saveOptions.setExportEmbeddedSvg(true);
	saveOptions.setExportEmbeddedImages(true);
	saveOptions.setSaveFormat(SaveFormat.HTML_FIXED);
	saveOptions.setShowPageBorder(false);
	return saveOptions;
}

/***
 * Create a document object with setting up the page margin to 0pt from all sides.
 * @param docInputStream
 * @return
 * @throws Exception
 */
private Document initDocument(final InputStream docInputStream) throws Exception
{
	// Setting encoding for conversion as UTF-8
	final LoadOptions loadOptions = new LoadOptions();
	loadOptions.setAllowTrailingWhitespaceForListItems(false);//REV-2646
	loadOptions.setEncoding(Charset.forName("UTF-8"));

	final DocumentBuilder builder = new DocumentBuilder(new Document(docInputStream, loadOptions));
	final PageSetup ps = builder.getPageSetup();
	ps.setTopMargin(ConvertUtil.inchToPoint(0));
	ps.setBottomMargin(ConvertUtil.inchToPoint(0));
	ps.setRightMargin(ConvertUtil.inchToPoint(0));
	ps.setLeftMargin(ConvertUtil.inchToPoint(0));
	return builder.getDocument();
}

@subhashlengare,

While using the latest version of Aspose.Words i.e. 18.4, we managed to reproduce this issue on our end. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-16758. Your thread has been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Hi,
can you let us know the status of WORDSNET-16758?
-Subhash

@subhashlengare,

Unfortunately, your issue is not resolved yet. We have completed the analysis of this issue and the root cause has been determined. We are currently working on implementation of the fix. We will inform you via this thread as soon as this issue is resolved. We apologize for any inconvenience.

Hi,
Can you tell me status of this task?
-Subhash

@subhashlengare,

We have good news for you i.e. WORDSNET-16758 has now been resolved and the fix of this issue will be integrated in next release of Aspose.Words i.e. 18.7. We will inform you via this thread as soon as 18.7 release of Aspose.Words will be published at the start of next month.

Hi Hafeez,

Can you please let us know the ETA on this?

-Subhash

@subhashlengare,

Aspose.Words for Java 18.7 version containing the fix of your issue will be released within next 2-3 days. We will inform you via this thread as soon as new version is available. We apologize for any inconvenience.

The issues you have found earlier (filed as WORDSNET-16758) have been fixed in this Aspose.Words for .NET 18.7 update and this Aspose.Words for Java 18.7 update.