[Answered ]-Why is my Docx converter returning 'None'

1👍

docx2pdf.convert always return ‘None’

The converted pdf file is saved to the ‘outputPdfPath’ file.

In order to show the pdf file to the user, you must read the pdf file from the ‘outputPdfPath’.

def reConverter(inputDocxPath):
    #reconvert docx to pdf
    
    print('reConverter: '+str(inputDocxPath))
    outputPdfPath = inputDocxPath.replace('.docx', '.pdf')
    convert(inputDocxPath, outputPdfPath)
    with open(outputPdfPath, "r") as f:
        test = f.read()
    print(type(test))
    print('test: '+str(test))
    return test

Leave a comment