Hi,
The table rows are getting compressed when saving as a pdf. Any reason why?
@priyanka9 Could you please attach your input and output documents here for testing? We will check the issue and provide you more information.
Hi @alexey.noskov,
i cant share the documents are they are confidential but i can share some screenshots. Also i observed that if i edit the word doc first (maybe add a space or change a letter) then if i save as pdf, styling is preserved.word.jpg (112.8 KB)
pdf.jpg (120.5 KB)
@priyanka9 I see the issue on the screenshots, but, I am afraid, without real documents it is not possible to determine the reason of the issue or analyze it. Please note it is safe to attach documents in the forum, the attachments are accessible to you as a topic starter and to Aspose staff.
Hi @alexey.noskov,
sorry that we are unable to share the documents but i realized the problem was because of formatting the cell width of tables. If i remove that block of code the problem isn’t there.
//this is the block of code
for (var row : currentTable.getRows())
{
for (var cell : row.getCells())
{
if (cell.isFirstCell() && firstCellWidth != null) cell.getCellFormat().setWidth(firstCellWidth);
}
}
is there another way to set cellwidth while saving as pdf?
@priyanka9 You code for setting cell width is correct. But could you please explain why you change cell width? If your goal is to convert MS Word document to PDF, usually no document preprocessing is required to get correct result.
hi @alexey.noskov,
we need a specific cell width for the tables so that is why we are setting cell width. In the case of tables, the formatting isnt consistent when converting word to pdf.
@priyanka9 Unfortunately, it is difficult to say what the problem is without an ability to reproduce the problem on our side. Since in the code document formatting is changed, it is expected that document layout also might be affected.