AlJohri / docx2pdf

MIT License
497 stars 94 forks source link

Update __init__.py #82

Open taylormadeapps opened 1 year ago

taylormadeapps commented 1 year ago

Fixes issue: https://github.com/AlJohri/docx2pdf/issues/77 for me. Submitting for review

AlJohri commented 1 year ago

Glad you figured it out! Do you know if this will break for previous versions of Word? Any links to documentation about the difference between these two functions?

taylormadeapps commented 1 year ago

Hmm, good point. I didn't think about regression. I'm wondering if we should do a check for the existence of the saveas2 function and if it doesn't exist then fallback to saveas.

Looking at something like use_old_save_method=hasattr(Dynamo, "saveAs2") and callable(getattr(Dynamo, "saveAs2")) but given that it's win32com.client - not obvious what the class name for document is.

Maybe a try and except might do the job. Any thoughts?