I'm trying to convert a bunch of Visio files to pdf in python. I have referenced this .doc to pdf using python and written the following code:import comtypes.client as comsformat=17visio = coms.CreateObject('Visio.Application')doc = visio.Documents.Open('map.vsd')doc.SaveAs('map.pdf', FileFormat=format)给我一个TypeError: call takes exactly 2 arguments (3 given)我一直在谷歌搜索,找不到有关如何使用python在Visio中打印为pdf的参考.I've been Googling and can't find the reference on how to print to pdf in Visio using python.推荐答案您应使用ExportAsFixedFormat代替SaveAs.您可以在此处.此函数可以与win32和comtypes一起使用.You should use ExportAsFixedFormat instead SaveAs. Documentation for this function you can find here. This function can be used with a win32 and a comtypes. win32com示例import win32com.clientvisio = win32com.client.Dispatch("Visio.Application")doc = visio.Documents.Open('map.vsd')doc.ExportAsFixedFormat( 1, 'map.pdf', 1, 0 ) 类型示例import comtypes.client as comsvisio = coms.CreateObject('Visio.Application')doc = visio.Documents.Open('map.vsd')doc.ExportAsFixedFormat( 1, 'map.pdf', 1, 0 ) 这篇关于将Python Visio转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-30 08:39