I just wanted to export docx to pdf so installed Spire.Doc on my MacBookPro with:
- Code: Select all
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()
but after installing it keeps failing with error:
---------------------------------------------------------------------------
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
I use spire-doc = "^12.4.0" in my project.toml
How can I fix this?