Forums

Convert docx to pdf using abiword

Hi, I have a wep app(django+python3.6) hosted on pythonanywhere and one of the features of this app is to convert docx uploaded into the app to pdf. I am using abiword but for some reasons it doesn't include the header and the footer of the docx into pdf. Do you know how can i fix this or do you have any over tool/library for this conversion? Thank you.

According to these abiword release notes, abiword has supported headers and footers since 2.8.1. We have 3.0.1 installed, so I don't think it's the header/footer part that's failing. It may be some other aspect that is not supported that you just happen to only be using in the header and the footer. One likely possibility is that you're using external images and so abiword is unable to get them. Try changing your headers and footers a bit to see what happens so you can get an idea of the feature that is causing the problem.

Hi, Thank you kindly for your reply. Based on your recommendations, i've made a battery of testing on multiple docx with several different types of headers and footers: with MSWord templates for headers and footers and simple lines of words placed in headers and footers. My conclusion is that somehow it begins converting after the header from the first page(the header and footer does not appear on the first page and, as you will see, not on the odd numbered pages) , the header appears on the second page but scrambled somehow(if the header in the original document has a picture -inserted locally, the picture does not appear in the pdf), the footer also appear on the second page but is not complete(if it has 3 lines, it will only take 2 to pdf) and, also, it puts text from the following page on the present page . So it looks like it begins the conversion after the header from the first page and it rearranges pages dynamically compensating the header from the first page, so the beginning part of any page but the first it will be on the last part of the preceding page and so on and it will arrange the header and footer accordingly, not to mention that the header and footer are scrambled as alignment and it cuts lines from the footer(as far as i have seen). What are your recommendations? Is there a fix to that or any other tool which can accomplish the conversion accurately ?

Thank you!

Interesting. Perhaps abiword only works for specific versions of docx. If you have the option, perhaps you could try saving your documents as an older version.

As for other conversions, perhaps you could try pandoc, which is also installed on PythonAnywhere.

Thank you for your response. It doesn't work with older versions of docs either. It does the same thing. Pandoc doesn't work either. Libreoffice is not available?

Thank you for your time.

No, LibreOffice is not installed.