We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Table column with dynamic length renders incorrectly in output PDF using Java

Hi Aspose-Support,
we encountered the following: When we have a dedicated word-document (attached) with some entry in a table cell, then the PDF printout adds a CR/LF. Why is the printout looking different to what we have in the DOCX?
When I do the same thing directly with Word (2016) then this does not happen.
Attached you will find 3 files:
Source File: GEN_Formular_113.docx
Aspose PDF: GEN_Formular_113_3G.pdf
Word PDF: GEN_Formular_113withWord2016.pdf

The table cell entry “LONGVersicherter:” gets a CRLF in the Aspose-PDF

we use the following code to generate the Aspose-PDF:
private static JsonConversionResponse convertDocToPdf(String sourceFile) throws Exception {

	logger.info("DOC to PDF Conversion Started");

	JsonConversionResponse ret = new JsonConversionResponse();
	
	String destFile = replaceFileExtensionWith(sourceFile, "pdf");

	Document doc = new Document(sourceFile);
	doc.save(destFile, SaveFormat.PDF);

	ret.setSourceFile(sourceFile);
	ret.setDestFile(destFile);
	ret.setPageCount(doc.getBuiltInDocumentProperties().getPages());

	logger.info("Conversion Completed");

	return ret;
}

we use the aspose-words-20.5-jdk17.jar - should be the newest. And to be even more precise: We previously used the version 19.11 and there the CRLF problem was even more problematic - it occured also with smaller entries in the table cell.GEN_Formular_113withWord2016.pdf (310.2 KB)
GEN_Formular_113_3G.pdf (97.8 KB)
GEN_Formular_113_3G.zip (437.2 KB)

@pkvogt

We have converted the shared document to PDF using the latest version of Aspose.Words for Java 20.5 and have not found the shared issue. Please check the attached output PDF.
20.5.java.pdf (102.1 KB)

Could you please convert your document using above code and share the output PDF? Please also share your working environment e.g.operating system and Java version etc. Please also make sure that you are using the same input Word document.

Hi Tahir, it is strange that you cannot reproduce the issue, because we exactly do it as described.
Aspose runs on a Windows Server 2016 Standard 1607 OS Build 14393.3326. The java version is version 8 update 201. That is the last free version.
java version “1.8.0_201”
Java™ SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot™ 64-Bit Server VM (build 25.201-b09, mixed mode)

Does this help?
Regards
Patrick

@pkvogt

Could you please convert your document to PDF using the latest version of Aspose.Words for Java 20.6 and share it here for our reference? We will investigate the issue and provide you more information on it.

Hi Tahir, good news with the usage of 20.06. The problem with the CR/LF in the cell does not appear anymore with this version. So this ticket can be closed!
Thanks for this one :slight_smile:
PatrickGEN_Formular_113.docx.pdf (103.3 KB)

@pkvogt

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.