我只想出口<代码>docx至pdf>
,这样就在我与以下人员串通时安装了<代码>Spire.Doc:
%pip install Spire.Doc
%pip install plum-dispatch
并管理法典
from spire.doc import *
from spire.doc.common import *
inputFile = "example-docs/document.docx"
outputFile = "document.pdf"
#Create word document
document = Document()
document.LoadFromFile(inputFile)
# Create a ToPdfParameterList object
parameters = ToPdfParameterList()
# Embed all used fonts in Word into PDF
parameters.IsEmbeddedAllFonts = True
#Save the file to a PDF file
document.SaveToFile("WordToPdfWithFontsEmbedded.pdf", parameters, FileFormat.PDF)
document.Close()
#Save the document to a PDF file.
# document.SaveToFile(outputFile, FileFormat.PDF)
# document.Close()
但我仍待决;
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-2-707d9ebcb6c3> in <cell line: 15>()
13
14 # Embed all used fonts in Word into PDF
---> 15 parameters.IsEmbeddedAllFonts = True
16
17 #Save the file to a PDF file
1 frames
/usr/local/lib/python3.10/dist-packages/spire/doc/common/__init__.py in CallCFunction(func, *args, **kwargs)
103 args = list(args) +[data]
104
--> 105 result = func(*args, **kwargs)
106 modified_value = cast(data, POINTER(c_uint64)).contents.value
107 if old_value != modified_value:
RuntimeError: ffi_prep_cif_var failed
问题是什么以及如何解决这一问题?