command line convert docx to pdf loses column widths

command line convert docx to pdf - table column widths are lost. Happens when docx loaded into UI as well. Is this a shortcoming of LibreOffice or is there a fix? Thanks

Does the same happen with an .odt document?

I created an .odt document with one table, adjusted column widths and ran command line to convert to pdf (as I did with .docx file). The column widths were retained properly for an .odt file, when converted to pdf.

problem is with tables in docx file. tables in the resulting pdf span the width of the document and columns are all the same width (width/space distributed equally across the width of the document)

When dealing with .docx files, I always stumble on issues with numbering and tables. Problem is that M$ Office specification are not public and when bits are available, it looks like M$ doesn’t follow them!

If you’re the document author, store them as .odt and convert only when required so by your sendees. Note also that M$ Word claims it can read .odt files.

BTW, have you embedded fonts in the original document? There a bug about bad Writer behaviour when fonts are embedded.

1 Like

Thank you ajlittoz . Starting with an odt is not an option for us but appreciate confirmation that table column widths is a problem for the docx to pdf conversion.

@tad: I didn’t state there is systematic problem in .docx to PDF conversion. There are potential formatting issues when converting tables from .docx to .odt (conversion happens every time you read in a .docx file). If table is as expected on screen, there should not be any difference when exported to PDF.

Except if you have embedded fonts in the document. This messes all your geometric table properties (see tdf#127036 and tdf#133113).

@ajlittoz Thank you again. This bug is what we are running into. Word doc (the final deliverable) creation is done in code (starting with template that has needed fonts) as well as the call to the command line libreOffice conversion to pdf (for preview) so no opportunity to employ workaround, but, very helpful to know what is causing the problem.

Same issue, When the word file is opened via MSWord, it is just fine but when converted to PDF via libre-convert, the images do not auto-resize the table cells. Any updates? or potential solutions?

@RahulLibreted: are you sure this is the same problem? You’re talking about images.

Check manually: within Writer, save your document as .odt to convert it to native format. In File>Properties>Font, see if font embedding is enabled. Report here your findings.

Thanks for the prompt response. During conversion,The big images inside a table cell are supposed to expand the columns right? But that does not happen. I use the CLI to do the conversion, Hence, I suppose the File> Properties> Font settings won’t be accessible? I will give a shot to .odt

So, I tried converting to .odt and used the LibreOffice Writer. Similar results. The cell is not resizing as per the image. I used MSWord and Word XML to initially create the document. Is it because of a compatibility issue with .docx files? I enabled the font embedding and tried again. There were no changes with the findings though.

@RahulLibreted: create a question (with a link to this one), describing your problem (because I think it is not the same), and attach a 1-page sample with a table and 1 image so that I can experiment.

Thanks, please refer to : When word file is opened via MSWord, it is just fine but when converted to PDF via libre-convert, the images do not auto-resize the table cells

to anyone running into this issue, we had a similar issue where we were filling a docx template programmatically, and then converting it into PDF using LibreOffice.
In our case the programmatic filling re-shaped the width of columns in tables, and pdf conversion seemingly broken it, but we learnt that it only reverted it back to the width of table columns in the template.

I’m not sure how did it remember the original state of word template after it was filled and modified, but changing the widths in the underlying template was reflected into the PDF in the end.

1 Like