ardata-fr / doconv

Other
13 stars 1 forks source link

docx2pdf - figure resolution is low in resulted pdf #3

Closed MaryHe closed 1 year ago

MaryHe commented 1 year ago

Hi, firstly thanks very much for the amazing package!

I have a .docx file generated from package officer that contains mostly figures. When I used docx2pdf to convert it to .pdf, the figure resolution in the resulting pdf seems very low. For example, if I use the 'save as' function in WORD directly to save this file as .pdf the file size is 205K and figures look ok. But the .pdf resulted from docx2pdf only has a file size of 130K.

I tried to set the resolution higher in my original .docx file, yet the resulting .pdf still has the same low resolution figures and same file size (130K).

Could you advise possible reasons? Or maybe add functionality that allows control of resolution of the converted .pdf?

Thanks!

davidgohel commented 1 year ago

Hi

I don't know the reason. It's fine on macOS so I suspect it happens on Windows. Are you working on a Windows or a macOS machine?

MaryHe commented 1 year ago

Hi, thanks for the response. Yes I am working on Windows.

MaryHe commented 1 year ago

I think I found something that may solve it, I would appreciate it very much if you can help look into it, as I do not have enough technical knowledge. Looks like the option wdExportOptimizeForPrint instead of wdExportOptimizeForOnScreen, in the PowerShell script, would generate a larger file, which I assume would have higher quality? https://learn.microsoft.com/en-us/office/vba/api/word.wdexportoptimizefor

davidgohel commented 1 year ago

sure, thank you for that.

I just push an updated version with your fix, could you try please and let me know if it fixes your issue (I don't have Windows available for now)

MaryHe commented 1 year ago

Yes it worked! Thank you so much! Will this version be pushed to CRAN?

davidgohel commented 1 year ago

Thank you for taking time to help!

yes, I'll send it to CRAN in a week or two