系统:
Python 3.6
Windows 10
目标:
使用Adobe Acrobat API使用“另存为”功能将pdf保存为JPEG。
注意:出于我的目的,我不能使用魔杖或其他包裹。
资源:
当前代码:
^{pr2}$问题:
jsObject为空
导致以下回溯:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-26-9c82c454eb2a> in <module>()
----> 1 jsObject.SaveAs(os.path.abspath('./output_example.jpeg'), "com.adobe.acrobat.jpeg")
AttributeError: 'NoneType' object has no attribute 'SaveAs'
错误文档说明:
GetJSObject
Gets a dual interface to the JavaScript object associated with the PDDoc. This allows automation clients full access to both built-in and user-defined JavaScript methods available in the document. For more information on working with JavaScript, see Developing Applications Using Interapplication Communication.
Syntax
LDispatch* GetJSObject();
Returns
The interface to the JavaScript object if the call succeeded, NULL otherwise.
考虑与AvDoc对象接口,因为其中一个链接显示了它的用法,然后从中构建pdDoc和jsObject。请确保还将进程包装在
try/except/finally
块中,以有效地释放COM对象,而不考虑错误。在相关问题 更多 >
编程相关推荐